'Tab size wrong with EditorConfig and SublimeText 3
With SublimeText3 my .editorconfig file contains:
[*.{h,cc,cpp}]
indent_style = space
indent_size = 2
tab_width = 8
I would expect tab characters in a file to expand to 8 spaces, but I'm seeing them expand to only 2 spaces. Hitting tab correctly indents by 2 spaces.
Is there a way to make it work as desired? So that tab characters expand to 8 spaces? But hitting tab still inserts 2 spaces?
Solution 1:[1]
That's because you're using indent_style = space
and providing indent_size = 2
.
If you want your tabs to spand 8 spaces, then use indent_size = 8
, but I'm pretty sure you don't want that!
In this case, since you want to work with tabs, then try this
[*.{h,cc,cpp}]
indent_style = tab
tab_width = 8
(Also its a good practice to check for mixed tabs and spaces in your files, that may lead to incorrect behavior in your config, which may not apply here, but it's a friendly reminder)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | amphetamachine |