Sunday, December 7, 2014

Indent two spaces per tab in Sublime Text 3

Indenting two spaces per tab is useful when programming in languages like Ruby. I was able to search for an easy way to do this in Sublime Text 2 but it took me sometime to figure out how to get this right for Sublime Text 3.

Here's how we can set this as a default for a user in Sublime Text 3

Step 1 : Sublime Text -> Preferences -> Settings - User. (Please read the PS below if you're a linux user)

Step 2 : Within the existing set of flower brackets("{}") that are specific to the user we need to add customized settings to override the default settings that one would find in Preferences -> Settings - Default. We need to add the below settings to use two space indentation -

Below is an example of how the user settings file would look like after you override the default settings with the above changes.

 Step 3: Save the changes and you should be good to go. 

P.S: Surprisingly, I found the Preferences section for the debian package(I had it installed on Ubuntu 14.04) of Sublime Text 3 at a different location than where it is when one sets up the same through Mac OSx.