Home > python > A Fast and Powerful Text Editor: Sublime Text 2

A Fast and Powerful Text Editor: Sublime Text 2

I tried Sublime Text 2 today and it looks great. Note that ST2 is not open source and you should purchase a license if you want to use it after evaluation. However, there is currently no enforced time limit for the evaluation.

First of all, it is cross-platform (Linux, Windows, OS X). There is no need to install it: just download an archive file and unpack it. Under Linux I put it to /opt (/opt/Sublime\ Text\ 2). In order to call it with the command “st“, I put the following script in my $HOME/bin directory (where $HOME/bin is in my PATH):

# call ST2 with parameters in the background
/opt/Sublime\ Text\ 2/sublime_text "$@" &

ST2 has tons of plugins available. To install them easily, first install “Sublime Package Control” (follow this link, everything is explained there).

I find the following plugins particularly useful:

  • SublimeRope (code-completion/refactoring)
  • SublimeLinter (check your syntax on the fly)
  • SublimeREPL (python/bash/cmd/etc integrated console)

How to install a plugin: in ST2, press Ctrl+Shift+P. Select “Package Control: Install Package”. Then choose a plugin to be installed.

Color Scheme: well, I tried ’em all but I didn’t really like any of them. So I stayed with the default (Monokai). If you know a cool color scheme, let me know.

In Python, it’s a good idea not to mix tabs and spaces. Here is how to replace tabs with spaces automatically: under Preferences -> Settings-User, add the following line:

"translate_tabs_to_spaces": true

Rename multiple instances of a word (beware, in the case of variables scope is not taken into account): Alt+F3.

User config files are stored in $HOME/.config/sublime-text-2/Packages/User.

If you want to enable / disable the automatic linting, add the following lines to SublimeLinter’s user keymap (thanks jswartwood for the tip):

// Enable background linting
{ "keys": ["ctrl+shift+l"], "command": "sublimelinter_lint", "args": {"action": "on"} },
// Disable linting
{ "keys": ["ctrl+shift+d"], "command": "sublimelinter_disable", "args": {"action": "off"} },


Update (20120813)
I found a nice color scheme, available here (down at the Bonus Options, direct link here). “Unzip and place the extracted tmtheme files in the Sublime Text 2 Packages/User folder, then enable the colour scheme via Preferences -> Color Scheme -> User“.

Categories: python Tags: , ,
  1. René
    August 10, 2012 at 22:05

    Renéks for the tip. I tried ST2 today, and I love it:
    It is full featured, unlike GEdit
    It is fast, unlike Eclipse
    It is configurable, like Emacs
    It is not Open Source, it is not even free, but it has many plugins and a vibrant community.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: