vjvo9g
Last Updated: February 25, 2016
·
13.35K
· wjonthomas
Profile image 3 gray small

Syntax-specific indentation settings in Sublime Text 2

Languages like YAML require text to be indented using spaces. Tabs are not allowed. So, if you typically use Sublime Text 2 with tabs as your default indentation, here's how you can force a certain language to always use spaces. I'll use a .yml file as an example, but you can follow the same steps for any file type.

  • While editing a .yml file in Sublime Text 2, go to the Sublime Text 2 menu. Go to Preferences -> Settings - More -> Syntax Specifc - User
  • Sublime Text 2 will open a settings file specific to the language you chose to edit settings for. In this case, I'll be editing the YAML.sublime-settings file, which will apply settings to only the YAML syntax language.
  • Use the following code to set up your indentation settings:

    {
        "tab_size": 2,
        "translate_tabs_to_spaces": true
    }
Say Thanks
Respond

2 Responses
Add your response

13627
2ee6d7ea900a650dd25e6596524384ef

Very simple. I love it!

over 1 year ago ·
14213
977d7c2d95f3326a50eeaccdc3ddc24f

Thanks !

over 1 year ago ·