You are here: Home Articles Sublime Text 2 for Zope and Plone
Navigation
OpenID Log in

 

Sublime Text 2 for Zope and Plone

by Martin Aspeli last modified Aug 13, 2011 03:53 PM

A few tips

Few things are as precious to a developer as his text editor. I've sworn by TextMate for many years, but recently there's been a lot of rage about Sublime Text 2.

I am currently trialling it, for a few reasons:

  • TextMate development seems to have run aground. This smells like the classic over-ambitious "version 2" rewrite syndrome, as TextMate 2 has been promised and not materialised for years.
  • Sublime Text uses Python for its plugins. I've written/tweaked a few plugins, and it's quite fun.
  • Sublime Text 2 is fast, even when opening very large folders, such as a fully built-out Plone buildout directory.
  • It's very keyboard-friendly, and the "goto anything" (Cmd+P) feature is really nice.
  • It can natively read TextMate bundles for things like colour schemes and syntax highlighting.
  • There are builds for Windows and Linux as well as OS X. I use both those operating systems at work, and a single license will work for multiple machines (i.e. it's per-user).

I won't say I'm 100% sure yet, but on balance, Sublime Text 2 (beta) feels very solid and is clearly actively developed. I've bought a license and will be using it full time for a while.

So far, there is a lot to like, though also a few things not to like:

  • The sidebar/projects feature has some UI problems. I listed them here.
  • The "find-in-files" feature just runs grep and displays the results as the terminal would. I much prefer Text Mate's version.
  • There's no multi-file search-and-replace yet.
  • The documentation is a bit patchy, but with the forums and Google, I've been able to find out must things.

I've spent a good amount of time customising and installing plugins to make it work better for me. I'll provide a run-down below, in case others are interested.

  • I don't much like the default "dark" theme. Far too depressing. Luckily, there's a really nice theme called Soda. I use it with the suggested Espresso Tutti Colori colour scheme originally for TextMate and the Meslo font (11pt). You can see how these are configured here.
  • I created a keyboard history plugin that works a lot like TextMate's Cmd+Shift+V/Cmd+Alt+Ctrl+V based on the code in this forum thread. You can find my version here.
  • I found a really nice in-line Pyflakes checker plugin here.
  • I use this plugin (originally found in the forums, sorry I've lost the link) to highlight all occurrences of the word currently under the caret, a feature I've missed from Eclipe that's useful for seeing how variables and methods are being used at-a-glance.
  • I use a pretty advanced import auto-complete and jump-to-definition plugin found here (note that right now there's a problem with the current head, which will probably be fixed imminently, but see this forum thread for updates). In buildout-based projects, I use collective.recipe.omelette to generate a parts/omelette directory that can serve as a Python path, and use this script to generate a suitable config file in a local buildout (just run mkcodeintel from the root of the buildout)
  • For following along a Python debugging session in Sublime Text, I'm using PdbSublimeTextSupport, a shameless ripoff of PdbTextMateSupport from Andi Zeidler and others.
  • I use mr.igor quite a bit to save me having to remember import locations. This plugin makes it work in Sublime Text.
  • The Zope and Buildout TextMate bundles work pretty much unchanged in Sublime Text 2 to get syntax highlighting and snippets for Zope and Buildout files. I made a few minor tweaks and uploaded them here.
  • UPDATE #1: I've created build systems for running a Buildout in the project directory, running the current .cfg file as a buildout, and re-running the last used buildout with mr.developer.
  • UPDATE #2: I've written a plugin for browser-like back/forward navigation as the selection is moved. See this thread
Document Actions

SublimeCodeIntel won't scan project_dir/.codeintel/config

Posted by http://droogie.myopenid.com/ at Aug 21, 2011 11:02 AM
I've setup this environment on two macbooks, I just bought a new one. On my old computer everything works perfectly, but when installing this on the new computer it fails. SublimeCodeIntel scans my 'which python' environment, but it fails to pick up my project config files and therefor parts/omelette. Any idea why this happen? I've tried to look at SublimeCodeIntel's code, without any success.

"find-in-files" with grep

Posted by http://witsch.zitc.de/ at Aug 24, 2011 07:05 AM
it's funny how different preferences can be. i immediately loved the idea of using `grep` for searching and appending the results to a continuous buffer. you can even edit/remove results that you don't need or have already worked on and still keep clicking on them to jump into the code. imo it's way better to work with than what's there in textmate… :)

sold!

Posted by http://tkimnguyen.myopenid.com/ at Dec 03, 2011 02:00 PM
You sold me. Just requested two licenses at work for John and me. :)

Python same namespace imports in SublimeCodeIntel

Posted by http://fabiocorneti.myopenid.com/ at Jan 05, 2012 07:02 PM
Hi,
I'm testing a simple modification to SublimeCodeIntel that should provide correct import completions for multiple Python packages in the same namespace without having to use omelette; if you're interested you can check the commit at https://github.com/[…]/38f0cc55e9d3b06b7ad592ac6844dea9fef9cd9d .
Plone Book
Professional Plone 4 Development

I am the author of a book called Professional Plone Development. You can read more about it here.

About this site

This Plone site is kindly hosted by: 

Six Feet Up