Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

like image 800
Geert Schuring Avatar asked Oct 15 '13 14:10

Geert Schuring


People also ask

How do I indent automatically in Sublime Text?

That's quite simple in Sublime. Just Ctrl+Shift+P (or Command+Shift+P on MacOS) to open the tools pallet, type reindent , and pick Indentation: Reindent Lines . It should reindent all the file you are in, just remember to save before running the command, or it may not appear.

Does XML have indentation?

No, the indentation does not matter in XML documents.

Does Sublime Text support XML?

SublimeText Indent pluginIt is smart enough to recognize XML or JSON even if you are editing plain text.


1 Answers

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.
like image 173
Adi Sutanto Avatar answered Sep 30 '22 01:09

Adi Sutanto