How to indent XML files automatically when opened in Sublime Text 2?

Geert Schuring picture Geert Schuring · Oct 15, 2013 · Viewed 80.7k times · Source

I'm using Sublime Text 2 (with the Indent XML plugin) for editing XML files.

My question is: How can I configure Sublime Text to automatically execute the "Indent XML" action right after opening a file named *.xml?

Thanks!

Answer

Adi Sutanto picture Adi Sutanto · Dec 9, 2014

To indent / prettify / beautify XML, I use SublimeText Indent plugin:

  1. Install the package with Package Control (search "indentxml").
  2. Open any XML file, or create a new file and paste any XML into it.
  3. Ctrl-K, F to indent it.