Mark
Mark

Reputation: 5088

Sublime tab size only working for some files

Im using Sublime Text 3 for a javascript app. When I tab, I want it converted to 4 sapces. So I have set:

"tab_size": 4,

"translate_tabs_to_spaces": true,

This works fine. But weirdly, on some files (that also have .js extension like the ones it works on), a tab still only translates to 2 spaces. How can i fix this?

Upvotes: 1

Views: 750

Answers (2)

jakub.g
jakub.g

Reputation: 41278

In my case, I had to set "detect_indentation": false, and then close and reopen the file. When you leave the file opened, it will "remember" the indentation even across Sublime restarts.

Upvotes: 4

idleberg
idleberg

Reputation: 12882

All settings in Sublime Text follow an Order of Precedence. Here's an hypothetical example for JavaScript (in ascending order):

  • Packages/Default/Preferences.sublime-settings
  • Packages/Default/Preferences (Windows).sublime-settings
  • Packages/User/Preferences.sublime-settings
  • Packages/JavaScript/JavaScript.sublime-settings
  • Packages/User/JavaScript.sublime-settings

In this case, the bold settings will override all the others. In your case, a JavaScript package might override your user preferences.

What you can do is define tab_size in Preferences > Settings - Syntax Specific. Make sure you're current view is a JavaScript file before opening the setting.

Upvotes: 1

Related Questions