Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Autoindenting doesn't work on Notepad++ correctly. I can't find the equivalent SciTE file. menu Settings -> Preferences -> MISC -> Auto-indent is checked. I can't find any other Python indent settings other than menu Settings -> Preferences -> lang/tab settings -> default tab settings -> Python -> size 4, replace by space.

if True:
pass

But it does continue indenting if manually indented:

if True:
    #foo
    pass

In SciTE it works as intended. I found the variable that's controlling this:

# python.properties
statement.indent.$(file.patterns.py)=5 class def elif else except finally for if try while with

scite:

if True:
    pass
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

This question deserves an updated answer: there is now the plugin Python Indent that, when enabled (Main Menu > Extension > Python Indent > Enable) auto-indents during typing Python. New lines after a colon : like in def foo(): indents the following line, resulting in:

def foo():
    """ works """
    pass

With current versions of Notepad++ comes the Plugin Manager (Main Menu > Extensions > Plugin Manager), that makes installing the plugin very easy.

share|improve this answer
add comment

Most developers of text editing programs misuse the name auto-indent, as does Notepad++, which only has "maintain indentation".

You could use the plugin NppAutoIndent.

The description at the Directory for Notepad++ plugins says:

NppAutoIndent plugin has 'smart' indentation for C-style languages, such as C/C++, PHP, Java and such.

It's the first release so don't expect it to be flawless, and of course it might not be completely to your preferences ;)

There is NO support for HTML/XML and such, maybe later, tag matching is much more difficult to implement.

Another indenter is UniversalIndentGUI, which expressly claims support for Python in its features list, and is available as a Notepad++ plugin.

share|improve this answer
    
@Ciantic: If it was you that accepted my answer, just a remark that accepting the answer and assigning the bounty are two different actions. For the later, use the Bounty button. –  harrymc May 10 '11 at 6:49
    
No it was not me. NppAutoIndent does not work for Python. I'll wait if someone comes up solution that helps with Python, if none appears I accept this too. –  Ciantic May 13 '11 at 22:26
    
@Ciantic: I have added UniversalIndentGUI, which could maybe do better for Python. –  harrymc May 14 '11 at 9:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.