Last Updated: February 25, 2016
· 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

2 Responses
Add your response


Very simple. I love it!

over 1 year ago ·

Thanks !

over 1 year ago ·