3

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

2 Answers 2

3

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.

2
+50

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.

3
  • @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, 2011 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, 2011 at 22:26
  • @Ciantic: I have added UniversalIndentGUI, which could maybe do better for Python.
    – harrymc
    May 14, 2011 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .