Wednesday, November 20, 2013

Sublime Text - The text editor of your dreams

I was introduced to Sublime Text last year by some friends at school.What is Sublime Text anyway? To put it simply, it is a text editor. One heck of a text editor ! You might used of have used Notepad++ in the past, Sublime Text is (in my opinion) even better.

Why do I give this editor such a reputation ? First of all, it looks awesome !




The colors are great. For people like me with eyes problem, this kind of color scheme is easy for the eyes. Also, notice the little map on the side, that little thing itself makes coding easier at some point. Sublime is not only about the GUI though. Where it begins to shine is within its functionalities. 

  1. Multiple selection: Sublime Text allows you to select a term, it could be a variable, a method name, a class name, multiple times. This will allow you to rename it everywhere in the code, all at once !
  2. Batch edit: You can modify multiple lines at once just my using multiple selection. 
  3. Syntax: Sublime adapts its colors depending on the programming language in the current file.
  4. Goto Anything: This is minor to some people but you can use Ctrl+P and type in a file name to actually reach that file immediately.
  5. Sublime Project: You can define a project file for your code and use many properties such as ignored files, build system and such.
Where Sublime Text gets really powerful is by its customization capabilities. Exploiting this makes your editor feel like a full fledge IDE. The first step is to download the Package Manager and install it. Then.. you have a universe of possibilities. You can change your colors, download source control plugins, linters, etc.  Begin my lauching the command palette (Ctrl+Shift+P) and type in "inst". You should see the option "Package Control: Install Package".

Here is my list of packages:
  • Soda Dark Theme: Change the look of my GUI to make it a little darker
  • Clouds Midnight: My color scheme
  • Alignment: This package is used to automate alignment in your code. For example, you have a series of assignment of variables in your code. It is easier to visualize if all the '=' where aligned along with the assigned values. Instead of doing it manually, Alignment does that for you.
  • Sublime ColorPicker: This package is great. With a simple keyboard shortcup, a color picker dialog pops up and when you choose a color, the RGB code is returned. Very useful for people doing CSS or WM configuration.
  • Clipboard History: Records all your Ctrl+C and allows you to view a list of everything you copied. 
  • SublimeLinter: This package is used to highlight potential errors in your code. It runs in the background but you can also ask it to show you a list of lint errors. 
  • SublimeCodeIntel: This package is my favorite. It allows you to jump to definitions (remember we are using a text editor), it has autocompletion and has function call tooltip.
All of the packages mentioned above are fully customizable using JSON configuration. They can all be installed through Package Manager !


At last, if you want a configuration hack for Sublime Text, I recommend this article: http://codethatworks.blogspot.ca/2013/02/hows-to-synchronize-sublime-text.html. It was writted by one of my ex-boss and it basically allows you to copy your Sublime Text configuration to DropBox, so everywhere you use ST, your packages will be loaded and your configurations too !


Enjoy your coding !