Rectangle 27 0

indentation Auto indent in Notepad++?


Indent by fold is great, except that it only indents by fold ;) In situations where you've indented a list initialization, unless the language uses a folding character to delimit the initializer, it'll end up un-indenting. An example is a multi-line array initialization in PHP using array( ... ), where () are non-folding.

You can use 'Indent by fold' plugin. Install it from the plugin manager. It works fine for me.

it does not unintend the closing brace

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


Hi @Dan the undo problem seem to have been fixed in newer version of indent by fold...

If the TextFX menu does not exist, you need to download & install the plugin. Plugins->Plugin Manager->Show Plugin Manager and then check the plugin TextFX Characters. Click 'install,' restart Notepad++.

In version Notepad++ v6.1.3, I resolve with: Plugin Manager->Show Plugin Manager** and then check the plugin "Indent By Fold"

Indent by fold is awesome. The fact that it works in arbitrary formatting (XML, C/++/#, etc.) is great. Only problem with it is the "undo" stack. When used, if you wish to undo to a point before when you indented, you have to undo through every line re-indentation, as it doesn't get added to the stack as a single command. Basically, be careful when working with long files.

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


In the 6.6.8 version I installed the NppAutoIndent plugin from Plugins > Plugin Manager > Show Plugin Manager. Then I selected the Smart Indent option in Plugin > NppAutoIndent. Hope this helps.

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


TextFX -> TextFX HTML Tidy -> Tidy: reindent XML
Note
Rectangle 27 0

indentation Auto indent in Notepad++?


TextFX > TextFX Edit > Reindent

@Fostah: you can also install the "Text FX Character" via >Plugins>Plugin Manager>Show Plugin Manager

I actually found this while looking for a way to format javascript code. Turns out, this works for .js files as well!

If your version is missing the DLL you can get it from the ZIP 5.9.0 version. Some of the later versions did not include this DLL. notepad-plus-plus.org/download/v5.9.0.html

Notepad++ will only auto-insert subsequent indents if you manually indent the first line in a block; otherwise you can re-indent your code after the fact using TextFX > TextFX Edit > Reindent C++ code.

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


I would also like to see this feature in Notepad++.

Most developers of text editing programs misuse this name (auto-indent). The correct name is "maintain indentation". Auto-indent is what you actually want, but it is not implemented.

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


indeed, I found this option Tidy (most recent HTMLTIDY.CFG), but it appears as gray and I can't click it..

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


Note that the link is direct to the download. The website is: universalindent.sourceforge.net. Also, this appears to be a GUI for configuring a reformating tool, rather than automatically formatting the text correctly to start with.

Try the UniversalIndentGUI plugin for Notepad++. It re-indents code based on some parameters. It worked well for me.

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


void main(){
  if(){
    if() { }  # here
  }
}
  • "Auto-indent" is the 2nd option in this group

Do also note that you're missing the block for the 2nd if:

In the latest version (at least), you can find it through:

Note that this auto-indent setting in Notepad++ assumes you do the first indent in a block manually; it doesn't auto-format the code for you.

[EDIT] Though, I don't think it's had the best implementation of Auto-indent. So, check to make sure you have version 5.1 -- auto-indent got an overhaul recently, so it auto-corrects your indenting.

Note
Rectangle 27 0

indentation Auto indent in Notepad++?


A little update: You can skip the TextFX Plugin and just use Tidy2. Here you can configure your own formating-rules for different types of codes. Easy to install and remove within

Can you explain a bit more?

and just search for Tidy2 and install it. Done.

Note