Sublime Text 3 for Python development
I’ve been heavy vim user for a couple of years. I had a very cool configuration, really got all these fancy vim key shortcuts muscle-memorized.
But then vim plugins (bundles) started annoying me. Often my configuration became obsolete after an upgrade. I had to go through documentation and set everything yet again.
So I decided to give Sublime Text 2 a try, and then Sublime Text 3. And in August 2013 I switched almost completely. I still love vim, but now I program mainly in Sublime Text 3.
- Why switch to Sublime Text 3?
- Brief history
- Configuration
- Plugins
- Final words
- Two years later update
Why switch to Sublime Text 3?
For me, these are the reasons:
- Sublime Text 3 is sooo pretty
- it’s also so freaking fast, way faster than Sublime Text 2
- and has vast range of plugins, and easy configuration.
Not much, you say? It was enough to made me switch editors.
Brief history
Sublime Text 2 was using Python 2.x as an API interpreter. Early in 2013, first build of Sublime Text 3 appeared, not even remotely complete. And it shipped with Python 3.3 interpreter.
Since then, Sublime Text 3 (now beta build 3047 or bleeding edge dev build 3052) has come a long way and can be used by everyday programmer.
What’s important is that many Sublime Text 2 plugins have been either ported or made Python2/3 compatible.
Configuration
Theme
There’s lots and lots of themes for Sublime Text 3. I currently use Monokai Extended, with Soda dark theme.
Perv Orange is also very good, but a bit darker than Monokai.
Both schemes have better restructuredText coloring. Default Sublime Text 3 syntax highlighting for rsT is… in a poor state.
Visual preview of my current configuration. (click to enlarge)
Some visual settings:
Typeface
I’ve tested Consolas, Monaco, Ubuntu Mono and Meslo. Last two are my favorite, I switch them back and forth very often.
Configuration for Meslo:
Configuration for Ubuntu Mono:
And some additional typeface-agnostic but font-related settings:
Python
This part of configuration helps with writing Python.
Behavior
Fixes some minor annoyings, like opening a preview after selecting file in side bar.
You can also change some settings on a per-project basis.
Simply open your project.sublime-project
file
(Project → Edit Project
) and add settings
section:
Configuration file
For lazy people: https://gist.github.com/pbanaszkiewicz/6351258.
Plugins
These are the plugins I can’t live (and program) without. Absolutely necessary.
Package Control
A package manager for Sublime Text 3. Helps you search for, install, upgrade and remove most of available Sublime Text 3 packages.
Git
Very popular and quite easy for basic application. There’s also some payable SublimeGit plugin I haven’t tried out yet. (It seems nice, though!)
Update 30.08.2013: I switched to SublimeGit plugin. It’s very similar to vim’s fugitive, so I’m already feeling good about it. Definitely well spent money on an alternative to Git.
GitGutter
Adds small icons in left margin indicating which lines have been added, modified or deleted.
GitGutter icons: for deleted, added and modified lines. (click to enlarge)
SideBarEnhancements
Adds obvious (but missing from pure Sublime Text 3!) context menu options for side bar.
Additional items in sidebar’s context. (click to enlarge)
Anaconda
So far, the best Python completion and linter for Sublime Text 3. You can believe me, I tested other ones, too.
Anaconda is actively developed, and its’ author is very responsive.
I highly recommend installing this package from git
, as I’m not sure
if recent critical patches were already pulled in by Package Control.
Warning: do not mistake with Continuum.io’s excellent Anaconda suite for Python.
Gist
This plugins helps managing (adding, editing and removing) GitHub gists. Needs a little bit of configuration efforts, but it’s generally worthwhile.
Final words
I hope I was somehow able to help you boost your Python development or encourage to use Sublime Text 3. Have a good time and nothing to debug!
Two years later update
It’s December 2015, so over 2 years have passed since this post was originally published. What changed in Sublime Text 3? Am I still using it?
The answer is: yes! Even though the development of Sublime Text 3 is stalled (if only it was open source) I’m still using it. It’s a great product that “just works”.
Here are changes in my configuration:
- I switched my theme to Solarized Light, because I’m programming a lot in a daylight and I need a good, light background.
- I’m using a new font: Hack. It works great, but as I mentioned in the original article, I like to switch fonts now and then. I’ll probably switch to something else really soon.
- Now I also use a bigger font size, and it works better for my eyes.
Solarized Light, Hack font face, and some of AMY’s code. (click to enlarge)
Here is a list of plugins that I got rid of:
- Gist: I’m not sharing so much code to be in need of plugin for that service.
New plugins:
- SublimeGit: it was mentioned in update to the original article, but this
plugin works excellent. It may not work great during rebases (doesn’t show
conflicting files), but I’d not trust any tool except
git
in such time. - SublimeLinter: excellent for checking my Python and JavaScript syntax correctness, and standards (like PEP8) compliance.
I’m really interested to see how my usage of Sublime Text 3 develops in future.