Make Sublime Text 2 Work For You

14 Jan 2013

Sublime Text 2 is a fantastic editor that is widely becoming a favorite among those who work with code. There are an impressive amount of customization and small tweaks you can make to really make sure that the software is working for you. After getting ST2 and making it my own, I've been working more effectively and more efficiently.

sublimetextlogo

Many of these ideas came directly from Wes Bos, a designer and developer who has a lot of really informative posts specifically about Sublime Text 2. In fact, he's soon releasing a book that will encompass all of his favorite bits.

Color Scheme

For those spending the majority of their work days writing code, few things can create more headaches than a bad theme to your text editor. This is a lesson I didn't learn until I switched mine for the first time and realized what a huge difference changing the colors truly makes.

There are quite a few color schemes already packaged with the editor, so you won't have to download anything else unless you really want to.

sample1

sample2

sample3

Alternatively, you can download one of many custom color schemes and themes available on Github. I chose to use Bos's custom theme Cobalt 2. You may recognize the cobalt theme from ST2's default color schemes, but this custom version makes it more aesthetically pleasing while also making it easier to read.

Here's a sample of Cobalt 2 in action (with jQuery syntax)

cobalt2

Line Padding

This tip again focuses on readability. Adding extra line padding to your code can make it much easier to sort through and differentiate different areas. I've also found it helps to keep place if it's necessary to look away for a moment.

Just add this to your User Settings page under /Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings

"line_padding_bottom": 1, "line_padding_top": 1,

Code with no line padding:

beforelinepadding

Code after adding line padding:

afterlinepadding

Finding Your Place

One extremely simple tip that has really helped me to consistently find my place when going between monitors is to turn on line highlighting. You can do this with this very simple line of code in your User Prefs page.

"highlight_line": true,

linehighlight

Close Empty Windows

One thing that really bugged me when I started using ST2 was that when I was closing out of my tabs, I would close the last tab of the window, then the window would stay open without any open files in it. I'm sure there are plenty of good reasons to have this as a default, but with my system of checking each tab as I close them, it really got annoying. However, it is an easy fix. Simply add the following to User Prefs.

"close_windows_when_empty": true,

Caret Style

This may or may not be considered very useful, but it has made more of a different to me than I thought it would. Changing the caret from the normal blinking to fading can make working in a text editor much more bearable. The fading looks nicer and is much easier on the eyes after hours, days, weeks, etc. of looking at your editor.

"caret_style": "phase",

Full Preferences

There are more changes that I have made that have come together to form a version of Sublime Text 2 that I truly enjoy using. Look below if you'd like to see my full list without explanations.

    {
        "auto_complete_commit_on_tab": false,   
        "bold_folder_labels": true, 
        "caret_style": "phase", 
        "close_windows_when_empty": true,   
        "color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme", 
        "fade_fold_buttons": false, 
        "find_selected_text": true, 
        "highlight_line": true, 
        "highlight_modified_tabs": true,    
        "line_padding_bottom": 1,   
        "line_padding_top": 1,  
        "save_on_focus_lost": true, 
        "shift_tab_unindent": false,    
        "theme": "Cobalt2.sublime-theme"    
    }