in Sublime Text 3 I have 4 tab spaces in User Preferences. This is the part of settings file:
{
...
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": false,
// If translate_tabs_to_spaces is true, use_tab_stops will make tab and
// backspace insert/delete up to the next tabstop
"use_tab_stops": true,
// Set to false to disable detection of tabs vs. spaces on load
"detect_indentation": true,
// Calculates indentation automatically when pressing enter
"auto_indent": true,
// Makes auto indent a little smarter, e.g., by indenting the next line
// after an if statement in C. Requires auto_indent to be enabled.
"smart_indent": true,
// Adds whitespace up to the first open bracket when indenting. Requires
// auto_indent to be enabled.
"indent_to_bracket": false,
// Trims white space added by auto_indent when moving the caret off the
// line.
"trim_automatic_white_space": true,
...
}
It works good except for Javascript files, where the tab spaces are 2. I do not understand why.
Any help?
I tried to create Javascript specific setting file, but it didn't work either.
I faced the same issue. The problem occurs if you open an existing file which has tab set as 2 spaces ( Files loaded from GitHub mostly have this ). On the other hand, if you create a new .js file, the tab is set as 4 as instructed.
As mentioned by @OdatNurd, you have "detect_indentation" set to True. This detects the indentation of loaded file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With