fstab
fstab

Reputation: 5039

Sublime Text is not converting tabs to spaces when indenting... why and how to fix it?

I have been using quite effectively Sublime text. I have one problem that stil bugs me.

While I type JavaScript code the tabs not converted to spaces if tab is pressed additionally to the provided indentation level.

The following screenshot may help you in understanding my problem:

enter image description here

As you can see the initial level of indentation is correctly formatted as 8 spaces. If I press tab once again, then an actual tab charachter is inserted, instead of 4 spaces, as I would like.

The following is my User Preferences.sublime-settings configuration file:

{
"color_scheme": "Packages/User/Cobalt (SL).tmTheme",
"detect_indentation": false,
"expand_tabs_on_save": true,
"font_size": 10,
"ignored_packages":
[
    "Vintage"
],
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"use_tab_stops": 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,

}

The configuration seems to be set correctly. Any idea on why this happens and how to solve it?

Upvotes: 4

Views: 1557

Answers (1)

Arun Koshy
Arun Koshy

Reputation: 21

Sometimes smart_indent can mess up things. Try adding the following line to Preferences>Settings-User

"smart_indent": false

Upvotes: 2

Related Questions