The gist of this quick post is how to specify settings that only apply to certain filetypes, in other words, syntax specific settings. Say you want 4 space tab widths and a ruler at 120 chars while working on Python files, and 2 space tab widths and a 80 char ruler with Ruby, in this post I’ll show you how to make that happen.

Open up a file with the extension you’d like to customize.

Go to Preferences > Settings – More > Syntax Specific – User

Sublime will bring up a blank file with the name Python.sublime-settings (prefixed with whatever file extension you are working with at the time, in this case Python)

In that file, add whatever settings you would like this type of file to have. I think a common use would be to specify different indentation settings for different filetypes. Don’t forget to format them in the sublime-settings type of way with the hash of setting name to value.

{
    "tab_size": 4,
    "translate_tabs_to_spaces": true,
    "rulers": [120]
}

The settings blob above specifies that I’d like a 4 space tab width and a ruler placed at 120 characters (if you’d like different settings you can consult this reference guide of available settings)

Save the file and you’re done!

Your custom settings will be applied immediately to the file you are working on and any other files of the same type going forward, no need to keep going through the menus and updating settings when you find yourself working on different coding projects.