Auto-Indent not matching spacing in a file.
I'm working on a project where I often need to switch between editing Java and editing an xml config file.
The config file has 2 space wide indentation. I did not make it, and I cannot change this format.
If I press enter at the end of a line, it puts my cursor at what appears to be a 4 space indentation so the block is offset from the rest of the file by 2 spaces. I then have to write my tags and then move it all back 2 spaces. This is quite annoying.
A temporary solution was to turn off the auto-indent in the settings but I want it on when I switch back to Java. It's just as annoying to have to turn it on and off frequently. Is there some way to make auto-indent "smart" and try to match the indentation style for that specific file?
Please sign in to leave a comment.
You can configure indentation settings per file type in IntelliJ IDEA. Set it to 2 spaces for XML files.