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
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/77604/2ee6d7ea900a650dd25e6596524384ef.jpeg)
Very simple. I love it!
over 1 year ago
·
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/106080/977d7c2d95f3326a50eeaccdc3ddc24f.jpg)
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#