On Intellij IDEA 14, I have tried to set my preferences in Editor > Code Style > LESS to do 2 space indents but no matter what I do, my code ends up getting formatted with 4 space indents. How do I get it to do 2 space indents for LESS?
Asked
Active
Viewed 1.3k times
12
-
Go to Editor > File Types, and make sure LESS files has `*.less` registered under it (and that Cascading style sheet does not). My guess is it's under LESS, but it's worth checking. – ajp15243 Jan 13 '15 at 16:28
2 Answers
29
If your project has an ".editorconfig" file, IntelliJ 14 uses that by default (which overwrites your settings). If you absolutely do not wish to use these settings, you need to disable the editorconfig plugin.

uwolfer
- 4,356
- 1
- 25
- 40
-
1Thank you - you saved me a lot of time with this. I was having the same issue but I wanted 4 spaces. I just modified the .editorconfig file and hey presto! – Joe Keene Aug 31 '16 at 07:26
-
1It is best to set the correct values in `.editorconfig` and have it version controlled. Then when you clone your project on another system it will work as expected without extra IDE configuration *even* if you use another editor or IDE. It is widely supported by modern editors and IDEs: http://editorconfig.org/#download – ccpizza Apr 01 '17 at 08:25
-
Doesn't work even after disabling editorconfig plugin in intellij idea 2017.3 – Gaurav Apr 17 '18 at 08:19
-
1Worked after disabling google-java-style plugin. It overrides your code-style configuration.. – Gaurav Apr 17 '18 at 08:52
0
Not as likely, but if you make a scratch buffer and rename it to filename.ext. It does not honor the code style for *.ext, it defaults to tabs. You have to copy the scratch buffer to a real file and then it will apply the code style for *.ext.

Elijah Lynn
- 12,272
- 10
- 61
- 91