Fun with Sublime Text

Sublime Text is the greatest thing since sliced bread. Here’s how I set it up to get the most out of it.

Step 1: Install the Package Manager!

  1. Open Sublime
  2. Toggle the Sublime console with ctrl ` (Control + backtick)
  3. Run the command on this page: http://wbond.net/sublime_packages/package_control/installation

Step 2: Syncing Via Dropbox

I use multiple computers, and want to sync my settings across them to have a consistent experience in Sublime. Make sure Sublime is closed for this part!

  1. Move your Sublime Text Package folders into Dropbox (I used Dropbox/settings/Sublime Text 2)
  2. Symlink the Dropbox-synced folders back to their original location

Here’s how I did it:
First, move the Sublime Package folders to Dropbox.

 $ mkdir ~/Dropbox/settings/Sublime\ Text\ 2
 $ cd ~/Dropbox/settings/Sublime\ Text\ 2
 $ mv ~/Library/Application\ Support/Sublime\ Text\ 2/Installed\ Packages/ .
 $ mv ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/ .
 $ mv ~/Library/Application\ Support/Sublime\ Text\ 2/Pristine\ Packages/ .

Then symlink them back into place!

 $ cd ~/Library/Application\ Support/Sublime\ Text\ 2/
 $ ln -s ~/Dropbox/settings/Sublime\ Text\ 2/Installed\ Packages Installed\ Packages
 $ ln -s ~/Dropbox/settings/Sublime\ Text\ 2/Packages Packages
 $ ln -s ~/Dropbox/settings/Sublime\ Text\ 2/Pristine\ Packages Pristine\ Packages

Step 3: Install Cool Packages!

To install a package, open the package manager (⌘+SHIFT+P), type “Install Package”, hit enter, then type the package name and enter.
Check out these packages:

  • SideBarEnhancements
  • AllAutocomplete
  • TrailingSpaces
  • SublimeLinter
  • Git

Step 4: Configure Settings (all of these go into Sublime’s User Settings: ⌘+,)

  • Tabs and Spaces
    {
    	"tab_size": 4,
    	"translate_tabs_to_spaces": false
    }
  • Ensure Newline at EOF
    "ensure_newline_at_eof_on_save": true
  • Trim trailing whitespace on save
    "trim_trailing_white_space_on_save": true
  • If you use TrailingSpaces, set some sensible settings in Preferences -> Package Settings -> TrailingSpaces:
    {
    	"trailing_spaces_include_current_line": false
    }
    

References: