Performance Zone is brought to you in partnership with:

Juri Strumpflohner mainly operates in the web sector developing rich applications with HTML5 and JavaScript. Beside having a Java background and developing Android applications he currently works as a software architect mainly dealing with the .Net technology stack. When he’s not coding or blogging about his newest discoveries he is practicing Yoseikan Budo where he owns a 2nd DAN. Juri is a DZone MVB and is not an employee of DZone and has posted 51 posts at DZone. You can read more from them at their website. View Full User Profile

My Sublime Text Setup

04.11.2013
| 4755 views |
  • submit to reddit

I absolutely love this editor. A ridiculously fast editor which has everything you’d love to have from a simple notepad to an advanced, extensible IDE with auto-completion, highlighting to whatever you’d like to have. This post aims at mainly being a setup reference for myself.

Actually, I’m a bit late now, as a couple of days ago Alex MacCaw posted published exactly a similar post to this one here. So go and check that out as well, it contains a bunch of valuable information.

Sublime Configuration

I usually have the following customizations:

{
    "font_size": 16,
    "tab_size": 4,
    "translate_tabs_to_spaces": true
}

The large font for being able to focus better on a smaller context which I found quite useful. Moreover it’s more relaxing for my eyes.

I usually leave the tab-size on “4” as that’s what my other colleagues are accustomed to have in their IDEs. But note you might want to set it to “2”, especially when using CoffeeScript as it is more handy there.

Access from the Shell

In order to use sublime productively, one of the first steps is to make it accessible from your shell.

On OSX, the best way (as already Alex mentions in his post) is to create a symlink to your Sublime installation directory like

ln -s "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl" /usr/bin/subl

But since I’m also working as a .Net developer and thus I’m having a Windows machine at work, I’d like to have the same functionality there as well. As such I created a special directory under C:\bin\utils which is linked in the PATH environment variable. Inside that directory I created a subl.cmd with the following content:

@echo off
"C:\Program Files\Sublime Text 3\sublime_text.exe" %1

Installing Packages

Sublime wouldn’t be that rich and useful without its packages (extensions basically). If you miss any kind of functionality, search for a package and I bet there is one already available.

Package Control

Url: http://wbond.net/sublime_packages/package_control

Package Control is simply a package manager for Sublime Text packages and extensions.

Package Control can be installed using Git. Navigate to the “Packages” folder (you can use your menu to find it Preferences > Browse packages...). Then execute the following commands

git clone https://github.com/wbond/sublime_package_control.git "Package Control"
cd "Package Control"
git checkout python3

Restart Sublime and you’re done.

To use Package Control simply press Ctrl+Shift+P to open the Sublime Menu and write

  • Install for installing a new package
  • Upgrade for upgrading an existing package or
  • Remove for removing an existing package.

My Packages

Here’s a list of packages I’m currently using with Sublime Text. I’ll add/remove this list over time as I find new interesting and useful ones. The installation instructions as well as the packages I listed should work on both, Sublime Text 2 as well as Sublime Text 3 (which is currently in private beta). But since I’m using the latter, you might experience some trouble in using some of them with v2.

Note, if there is no hint about the installation of a package, you can simply use Package Control for adding the extension to Sublime Text.

Package Name Description
Emmet Adds Zen-coding capabilities to Sublime Text. See the docs for a list of available commands and usage instructions.
Sublime TFS A must have package if you have TFS as your version control system. After installation you should see a "TFS" menu which illustrates the major commands.
SideBar Enhancements Adds a bunch of useful functionalities to your Sublime's sidebar context menu like copy path, duplicate file, move, copy etc...
SublimeLinter Linting support for Sublime
DocBlockr Augments Sublime for easy commenting of your JavaScript code. Adds comment blocks like:
/**
 * [testFunction description]
 * @param  {[type]} param1
 * @param  {[type]} param2
 * @return {[type]}
 */
testFunction : function(param1, param2) {
}
AllAutocomplete This package extends Sublime's amazing autocomplete support over multiple files.
TrailingSpaces Allows to configure Sublime to highlight or even automatically remove all trailing spaces. Take a look at the docs for instructions on how to configure it.
My current setup adds the following to the user preferences:
{ "trailing_spaces_trim_on_save": true }
and this to the package's preferences
{
    "trailing_spaces_include_current_line": false
}
SublimePrettyJson Prettifies a compressed JSON string in the editor.
MarkdownEditing If you love markdown teh same way as I do, this plugin is definitely a must have.
MarkdownPreview Although I use this less often, it is quite useful for quickly previewing your created markdown document in a browser.


Published at DZone with permission of Juri Strumpflohner, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)