I have
"translate_tabs_to_spaces": false
in my Preferences.sublime-settings, but if the file is indented using spaces, pressing the Tab key inserts spaces, not the tab itself.
- Why is that?
- How it is expected to work?
I have
"translate_tabs_to_spaces": false
in my Preferences.sublime-settings, but if the file is indented using spaces, pressing the Tab key inserts spaces, not the tab itself.
ST dedects indentation style (tabs or spaces) and width of opened files by default (see: "detect_indentation"
) and adjusts "tab_size"
and "translate_tabs_to_spaces"
for the view accordingly.
What I don’t understand is why it adjusts translate_tabs_to_space
for the current indentation style? Isn’t it the whole purpose of translate_tabs_to_space
is to force tabs or spaces regardless of the current indentation style? And if it doesn’t force tabs or spaces regardless of the current indentation style, then I simply don’t understand how exactly it can be useful. Maybe I’m stupid, but could you explain it to me better?
This setting just says “use spaces instead of tabs” to indent code. It could also be named “indent_using_spaces”, but actually it also replaces tabs in all other locations in the middle of a line and thus it is named as it is.
That’s also a good example for ST’s settings (file) hierarchie, discussed earlier.
You can specify per-user defaults for those settings in Preferences, which would be overridden by project-specific, syntax-specific or view-specific settings. With detect_indentation: true
ST adjusts those settings automatically based on file content on “view-specific” level.
Those settings are useful in case you don’t like automatic indentation style/width detection. By setting detect_indentation: false
ST would always use settings from Preferences. But in that case you are likely to create files with mixed indentation styles, which is terrible, IMHO.
So is it correct to say that "detect_indentation": true
overrides "translate_tabs_to_spaces"
?