Edit HTML files with CSS and JS using Sublime Text 3. To reindent in Sublime Text 3, I use shortcut ctrl + shift + r when I paste a code out. What is the best practice to automate the TAB key by decreasing tabs from 4 spaces to 2, for example?
Edit HTML files with CSS and JS using Sublime Text 3. To reindent in Sublime Text 3, I use shortcut ctrl + shift + r when I paste a code out. What is the best practice to automate the TAB key by decreasing tabs from 4 spaces to 2, for example?
To set the default, go to Preferences -> Settings - Default/User
and use the following setting:
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"detect_indentation": false
}
Edit:
After setting Preferences -> Settings - Default/User
, select all text go in Edit -> Line -> Reindent
If you want to add a shortcut to this action go to Preferences → Keybindings
and add
[
{ "keys": ["f12"], "command": "reindent", "args": {"single_line": false}}
]
Then just select the whole text and press F12
.