Wednesday, November 30, 2011

Setting Tab Preferences for ColdFusion Files in SublimeText 2 on OSX

Ever since I started using Indy's ColdFusion SublimeText 2 Bundle on OSX I've had issues with Sublime ignoring my "User File Settings" for tab behavior.  I like to keep my tabs as tabs and not have them be spaces, and no matter what I added to my user file settings tabs were being interpreted as two spaces.

The only way I was able to override this behavior is to open a .cfm file and gointo Preferneces -> File Settings  - More -> Syntax Specific - User and add the following JSON string:

 {"tab_size": 4, "translate_tabs_to_spaces": false}

Lastly save the file by going to File -> Save As and make sure its saved as:

/Users/username/Library/Sublime Text 2/Packages/User/ColdFusion.sublime-settings

According to the SublimeText Documentation (http://www.sublimetext.com/docs/2/indentation.html) the order preferences are applied is:
  1. Packages/Default/Base File.sublime-settings
  2. Packages/Default/Base File (<platform>).sublime-settings
  3. Packages/User/Base File.sublime-settings
  4. Packages/<syntax>/<syntax>.sublime-settings
  5. Packages/User/<syntax>.sublime-settings
Since the Packages/User/.sublime-settings file is processed last hence will override any other settings.  The strange thing was that I could not find any tab preferences stored in any of the other 4 files that were processed before the language specific ones.   
Fork me on GitHub