Nathan Hoad

Choosing a Python IDE, Part One: Sublime Text 2

April 28, 2012

Over the next few weeks, I’m going to be trying out a lot of different Python-based IDEs. I’ve been using Vim since 2008, occasionally moving away from it to use Netbeans or Eclipse for large PHP / Java projects, but for the most part, I’m a very satisfied Vim user. So why am I trying out all of these editors?

Basically, I’m hearing about them more and more. Apparently they make Python development easier, with integrated debugging, integrated version control and whatnot. However the main thing I’m interested in when using these IDEs is introspection based code completion and documentation. If I can get the documentation and all available functions for os.path simply by typing it, I like it. For other areas, e.g. class/method definition, tag completion in Jinja, snipMate like tab completion is good too.

So, with all that said, here’s a list of the IDEs I’ll be trying out (in order)

Sublime Text 2

Sublime was the first editor I used - it’s something I’ve been meaning to try for a while, on the recommendation of a friend from work. I worked with it for a week, and overall it was good, but there’s a lot of buggy behaviour that occurs often in daily use.


Extensibility is arguably Sublime’s biggest and best feature. Extensions are written in Python, as Python classes. Frustrately, it took a third party tutorial for me to figure out how to bind these plugins to keys, or do anything substantial with them - but never the less, they’re plain Python, so it’s not hard to write them.

Visual Appearance

Visually, the editor is superb. There’s smooth scrolling, a lot of nice colour schemes, and a minimap of the current file you’re editing. While they look nice, I don’t believe smooth scrolling or the minimap actually provide any benefit to the coder - they’re just there. In fact, the Sublime front page mentions the minimap as one of the top features, yet gives no use case for when it would be useful. Also, on my machine (Lenovo E520) the editor is quite responsive despite all the flashiness.

Vim Bindings

Vim keybindings - in my opinion, the mark of a decent IDE is one that has Vim keybindings. There are no obvious GUI options for this, but it’s available in the settings file, at the bottom, as a plugin called “Vintage”. The keybindings aren’t complete. The shortcuts I missed the most were gq, R, :<num> and Ctrl-n. However the extensibility of the editor means I could add them if I wished.

There was some strange behaviour with switching modes - occasionally I found myself in insert mode randomly, and from time to time I had to press escape multiple times to get out of insert mode.


One thing I was after was an introspection based autocomplete, which Sublime does not offer - it’s all word based on the current file, the same as Ctrl-n in Vim.

The snippet support however is quite good. I can type while and get the base syntax for a while loop, or class for a snippet defining a new class. Again, this is completely extensible with a straightforward syntax to add your own snippets.

I’ve always been annoyed with large menus - for example Netbeans, or Eclipse. They have humongous, expansive menus that are hard to navigate. If you have an action you want to perform repeatedly, often there’s no keyboard shortcut for it - so you get to navigate the menus repeatedly.

However, Sublime has nothing of that. You can search the menus with the Command Palette - Ctrl-Shift-P, or rebind any shortcut you wish to any menu item. For example, I wanted a shortcut for File > Open Folder, so I added this to the Key Bindings file:

{ "keys": ["ctrl+u"], "command": "prompt_open_folder" },

And that was it. Very impressive! Like I mentioned earlier, Sublime is very extensible. The same goes for editing shortcuts you don’t like - they’re all listed in this file, so you can remove or change them to your heart’s content.

The Build System

Sublime’s build system is quite simple, but powerful. We use an in house tool for copying files to specific directories on development machines - adding support for this took me 30 seconds. There’s no menu item for editing a build system once you’ve closed it, however - you need to navigate to the file on the drive and edit it that way. The same goes for removing one.

At times it’s a little naive - starting a Flask application results in it not handling restarts properly upon code modification, and apart from that it naively executes whatever file you’re trying to “build”, which is fair enough.

Package manager

That’s right - Sublime has its own package manager. It isn’t installed by default, you have to… install… the package manager. Installing it is simple - they ask you to open the Sublime console and execute a large set of abritrary Python commands. I can’t help but feel as though that could be integrated somehow.

Still, it’s nice that they have a clear repository for installing plugins. It makes it easy to install plugins, search for them and whatnot.


By default, closing all open files in a window leaves you with a blank window, and looks really strange. There’s a configuration option to change this behaviour, with the other option being “close the window immediately”. I’d like it if there was an option for “close the window if there’s no open files/folders, but not if it’s the last one”. This behaviour has resulted in me closing sublime completely multiple times.

Some menu options don’t do anything at all. Namely, Preferences > Browse Packages, and Tools > Macros.

Ctrl-Tab and Ctrl-Shift-Tab to cycle through tabs has really buggy behaviour - sometimes they start working backwards to how you expect. I’ve even gotten it cycling in order 1 3 2 4, 1 3 2 4, etc before. This happens fairly regularly in the version I’m using (2.2181), so be prepared to encounter it a lot if you’re new to it. It’s definitely affected by how many tabs you have open at once.

Update: The Ctrl-Tab behaviour described here is actually a feature! The idea is that it cycles through in the order you’ve opened or last viewed the files. Personally I think that’s a terrible thing to default to Ctrl-Tab, but hey.

All configuration of Sublime is done with a set of very large JSON files, that enforce the strict JSON parsing rules you’d expect - primarily, if you add a new value to an object, you must not have a trailing comma. Given the choice, I’d have used YAML files for configuration, or even a UI based one.


There’s a few things that don’t fit elsewhere, that are definitely worth mentioning about Sublime.

Good line wrapping support. If you have a line that wraps, and you navigate down, then Sublime navigates you to the next visual point on the wrapped line. Vim behaves more logically, instead taking you to the next real line, seemingly “jumping” over a line. I’ve always turned line wrapping off so this is usually hasn’t bothered me though.

The default syntax highlighting for Markdown is pretty ugly. I’m using the Sunburst colour scheme and all headers are rendered in gold ol' brown. The Python syntax highlighting for the same colour scheme is fantastic, however.


Sublime is a great editor - if you’re prepared to put a lot of time into customising it for your own use. A lot of the issues I mentioned could likely be fixed if I wanted to put time into fixing them, but the amount of issues left me feeling drained. If you want an editor you can customise almost as much as Vim, but without the terminal, definitely check out Sublime.

There was a lot I found missing, that I wouldn’t find missing in the terminal environment. Whenever I needed to commit some code, I had to switch to a terminal. Whenever I needed to find something not in the directory I opened, again, the terminal. It’s not so bad when you’re using Vim, because you’re already using a terminal environment. Switching from a GUI editor to a terminal is jarring and breaks concentration. With Vim, I can Ctrl-Z out, or switch to a new screen window. Even now that I want to commit this article, I have to stop and think “oh, how can I do that?” which isn’t good.