Question

By default IntelliJ IDEA 7.0.4 seems to use 4 spaces for indentation in XML files. The project I'm working on uses 2 spaces as indentation in all it's XML. Is there a way to configure the indentation in IntelliJ's editor?

Was it helpful?

Solution

Sure there is. This is all you need to do:

  • Go to
File -> Settings -> Global Code Style -> General
  • Disable the checkbox next to 'Use same settings for all file types'
  • The 'XML' tab should become enabled. Click it and set the 'tab' (and probably 'indent') size to 2.

OTHER TIPS

In IntelliJ IDEA 10.0.3 it's File > Settings > Code Style > General

Note: make sure to not use the same file in two project, or your settings might revert to the default (4 spaces), instead of the custom XML tab indent size.

See bug IDEA-130878, for the latest IntelliJ IDEA 14 (Oct 2014)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top