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: