Often SublimeText 2 opens files and if it finds in some place some spaces instead of a tab.
I said to force everything to 4 tabs. Not to convert manually every file I open to tabs (like in How to replace four spaces with a tab in Sublime Text 2?)
Sometimes I have a document with tab indentation of 4 spaces and when I press tab it writes 4 spaces!
"detect_indentation": false,
"translate_tabs_to_spaces": false
(doing tab_completion=true it helps)
To configure the tab width in Sublime Text 3, click on “View” in the top bar, then click on “Indentation” in the drop-down list. Next, in the second level of the drop-down list select the width you want a tab to take up. Sublime Text 3 defaults to tabs being four spaces wide.
That's quite simple in Sublime. Just Ctrl+Shift+P (or Command+Shift+P on MacOS) to open the tools pallet, type reindent , and pick Indentation: Reindent Lines . It should reindent all the file you are in, just remember to save before running the command, or it may not appear.
by pressing ctrl+f12, it will reindent your file to a tab size of 4. if you want a different tab size, you just change the "value" number.
Changing default indentation settings The following File Type Preferences determine the indentation settings: translateTabsToSpaces: set to either 'true' or 'false'. If true, then when tab is pressed, an equivalent number of spaces will be inserted into the buffer instead. Defaults to false.
If you set detect_indentation
to true
then ST2 will scan what the file uses for indentation, and that (a tab or spaces) will be what is inserted when you hit the Tab key. If you look at the bottom of the ST2 window, on the right side just to the left of where it shows the language of the current document, it should say something like Tab Size: 4
or Spaces: 4
. You can click on that to (un)set the Indent Using Spaces
option, as well as setting the size at which the tab character is rendered.
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