Setting Up Sublime Text

Ever since I have come to know and used Sublime Text, I have fallen in love with it. In my pre-sublime text days, I was your usual friendly neighbourhood IDE guy who loved all those cool development features bundled in to a “one size fits all” software package.

As much as I liked working in an IDE, I always felt a bit lethargic. The most annoying part for me was when the IDE would hang or respond 3 seconds late, leaving my thought train(and the code in my head) out in the cold.

My move to Sublime Text was not a conscious decision, rather just a result of exploring other code editors but gradually, I felt its stripped down, no fuss interface helped me focus a lot on doing what I loved and that is writing code.

If I was to summarize my switch from an IDE to Sublime Text, I would do it by quoting the famous dialogue between Morgan Freeman and Christian Bale from The Dark Knight.

Lucius: Hardened Kevlar plates over titanium-dipped tri-weave fibers for flexibility. You’ll be lighter, faster, more agile. (Bruce presses one of the forearm armors and a spike shoots off) Lucius: Perhaps you should read the instructions first? Bruce: Yeah. Lucius: Now, there is a tradeoff. Separation of the plates makes you more vulnerable to knives and gunfire. Bruce: We wouldn’t wanna make things too easy, now, would we?

Download/Install Sublime Text

First off, download and install the Sublime Text 3 build built for your operating system. Though it is dubbed as a beta version, I have been using it for years now without any real problems so it is a safe bet. Still, if you are a bit nervous trying out beta software, you can download Sublime Text 2.

For starters, the default Sublime Text installation is pretty cool to work with but I have become accustomed to performing a ritual whenever I have to start with a fresh installation of Sublime Text.

My ritual consists of the following steps.

Download/Install Source Code Pro Font

The Source Code Pro font is a freebie by Adobe(yes, that photoshop software company) that helps to make your code more legible. You can download it from Github. The download link is right at the bottom of that page.

Once you have downloaded it, go ahead with the install. I will show you how to install in on Ubuntu.

From the zip archive you just downloaded, unzip the true type font folder at /source-code-pro-2.010R-ro-1.030R-it/TTF/ to your desktop.

Execute the following commands in your terminal.

# make a separate directory for source code pro font
sudo mkdir /usr/share/fonts/truetype/source-code-pro/

# copy true type font files to source code pro font folder
sudo cp <path-to-your-home-folder>/Desktop/TTF/* /usr/share/fonts/truetype/source-code-pro

# rebuild font cache
sudo fc-cache

Prettifying the User Interface

Launch Sublime Text and copy the default preferences over into the user preferences. You can do so by opening the default preferences file through Preferences > Settings - Default and the user preferences file through Preferences > Settings - User.

Next, edit the following keys in the user preferences file with the values shown.

{
    "font_face": "Source Code Pro",
    "font_size": 12,
    "margin": -2,
    "translate_tabs_to_spaces": true,
    "use_tab_stops": true,
    "word_wrap": "true",
    "highlight_line": true,
    "caret_extra_top": 2,
    "caret_extra_bottom": 2,
    "line_padding_top": 2,
    "line_padding_bottom": 2,
    "scroll_speed": 0.5
}

You can find each key and set it’s value or simply copy/paste the above JSON into the user preferences file.

Install Package Control

One of the other great things about Sublime Text is it’s plugin based architecture. There are tons of plugins available for lots of cool stuff.

In order to make it easy for you to browse and install packages right from Sublime Text, you must first install the Package Control plugin.

Press ctrl+` to bring up the console and paste/execute the following code snippet.

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Once you are done, restart Sublime Text. You can now use the package control plugin from the preferences menu.

Plugins In My Toolbelt

Here are a few plugins I use with Sublime Text that help my development workflow.

  1. Sublime Git
  2. Rubocop(for Ruby development)
  3. Ruby Debugger(for Ruby development)

Last Words

Though my Sublime Text installation is not that impressive, it works for me. I would strongly suggest mastering Sublime’s keyboard shortcuts as they really are the killer feature of Sublime Text.

The Puzzle of Motivation

A few thought provoking findings on motivating twenty first century cognitive workers. Continue reading

What's New In Laravel 5

Published on August 17, 2015

Using Laravel 5's Authentication Facade

Published on August 17, 2015