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 }
Written by Jon Thomas
Related protips
2 Responses

Very simple. I love it!
over 1 year ago
·

Thanks !
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sublime text 2
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#