Auto format document with Notepad++

47

15

In Visual Studio, (and a few other Microsoft editors), you can auto format a document with a simple Ctrl + K, Ctrl + D.

This inserts line breaks and tabbing automatically.

Is there a similar feature in Notepad++?

Irfy

Posted 2009-10-22T15:04:09.433

Reputation: 605

Answers

23

TextFX has the options to insert line breaks and tabbing:

TextFX

ukanth

Posted 2009-10-22T15:04:09.433

Reputation: 9 930

Why do I not see TextFX in the menu bar as you do? – Pacerier – 2015-07-03T08:05:47.467

If you can not see TextFX in your menu,you can install it's plug in from http://sourceforge.net/projects/npp-plugins/files/TextFX/TextFX%20v0.26/

– ukanth – 2015-07-04T08:41:46.327

19

Download the "NppAutoIndent" plugin.  In Notepad++:

Plugins → Plugin manager → Available → NppAutoIndent

The "NppAutoIndent" plugin has 'smart' indentation for C-style languages, such as C/C++, PHP, and Java.  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.  To use it, select your code and:

TextFX → TextFX Edit → Reindent C++ code

If you cannot see TextFX in your menu, you can install its plugin from SourceForge.

References:

hasanghaforian

Posted 2009-10-22T15:04:09.433

Reputation: 801

14

For JavaScript, the JSTool plugin will do this job.

enter image description here

SUN

Posted 2009-10-22T15:04:09.433

Reputation: 141

very pleased with formatting result and better than tidy2 – Iman Abidi – 2015-09-14T05:43:11.300

4

For markup / xml there's a plugin called 'XML Tools'.

This can be added via the plugin manager inside Notepad++.

maxp

Posted 2009-10-22T15:04:09.433

Reputation: 248

1It can't seem to clean HTML it just says errors in the document without telling me what they are. – Matthew Lock – 2013-01-11T08:32:59.307

1

Here are most of plugins to format your code.

JStool (JSmin):
UniversalIndentGUI ( Enable text auto update' in plugin manager-> UniversalIndentGUI
Shortkey = CTRL+ALT+SHIFT+J )


TextFX : ( Shortkey = CTRL+ALT+SHIFT+B or TextFX > TextFX Html Tidy > Tidy: reindent XML) TextFX has the benefit of wrapping long lines, which XML Tools does not do, but doesn't indent those new lines correctly.


XML Tools : (customized plugin for XML; Shortkey = CTRL+ALT+SHIFT+B or XML Tools > Pretty print [Text indent])
XML Tools complements TextFX by indenting the newly wrapped lines nicely.

T.Todua

Posted 2009-10-22T15:04:09.433

Reputation: 2 436