How To Auto-Format / Indent XML/HTML in Notepad++

SBoss picture SBoss · Aug 19, 2011 · Viewed 1.1M times · Source

Is there a way to re-indent a block of code? I'm looking for something similar to Ctrl+Shift+F in Eclipse (Auto-Format/Indent).

To be clear,

  • I already know how to format XML outside of Notepad++ (Eclipse works fine, as mentioned) so I don't need a bunch of links to other XML-formatting tools.
  • I'm specifically working with XML and HTML.
  • Ideally, there's a keybinding as convenient as the one in Eclipse, so I don't have to break my workflow.

I already know about NppAutoIndent - it won't work, as I'm working with XML, HTML and CSS.

Answer

remipod picture remipod · Jan 9, 2012

Since I upgraded to 6.3.2, I use XML Tools.

  • install XML Tools via the Plugin Admin (Plugins → Plugins Admin... Then search for "XML Tools", check its box and click the "Install" button).
  • use the shortcut Ctrl+Alt+Shift+B (or menu → Plugins → XML Tools → Pretty Print)

In older versions: menu → TextFX → HTML Tidy → Tidy: Reindent XML.