Musings of an anonymous geek

March 19, 2007

Code Editor Goodness: Komodo Editor

Filed under: Apple,Linux,Python,Scripting,Sysadmin,Technology — m0j0 @ 7:55 am

Geez…. for a sysadmin I sure seem to write a lot of code. In the past year I’ve written an assignment type for Moodle in PHP, cobbled together an API in Perl to manage various LDAP resources, and I’ve just completed a prototype for an XML-RPC server that will be an interface to our data warehouse (which I designed, and wrote ETL scripts for in Perl, awk, and shell). Whew!

With all of this going on, a good editor is necessary. I’m a sysadmin *first*, and that is where my training is, so naturally I use vi. I understand that “real” programmers use Emacs, but it really doesn’t fit my brain, and if you use vi for any length of time, I believe it becomes dang near impossible to convert without a frontal lobotomy. 😮

Though I like vi a lot for day-to-day administration, I’m not always a fan of how it handles programming, and it seems to take a lot of work to get it to work the way you want it to. My biggest pet peeve about vi is when you enter insert mode and then paste in some code that was already indented. Vi likes to indent it again. Usually I can get around this by setting all of the *indent settings to “no”. For example “:set noautoindent”. However, I set everything I could find yesterday and it was still doing some goofy things with my pasted in code.

Once I got my code in there, and manually removed all of the stupid indentations, I realized another thing: I hate vi’s python syntax highlighting, and it doesn’t handle python indentation in a particularly “smart” way. For this reason, I generally use JEdit for programming, but there’s no Vi key bindings for JEdit, so I went looking for a new editor to see what I could find. What the heck, it was Sunday. What else did I have to do?

I scored. Komodo Editor is a free-of-charge code editor that runs on Windows, Mac and Linux, is as customizable as you’re likely to ever need it to be, and….. wait for it…. it has a Vi mode!

Since my current project is working with Python, it’s also super, super nice to have the indentation guides, and since I’m a Python newbie, it’s also fantastic to have some of the gentle reminders that I’ve indented wrong, or forgotten the colon after my def. I’ve also made use of the basic-but-useful file comparison interface, which does a diff on files of your choosing. It also does some things that I liked about JEdit, like handling file changes on disk in an intelligent (and flexible, should your definition of ‘intelligent’ differ from Komodo’s) way.

The simple code folding is as one would expect in most graphical editors, and it’s a tad nicer than JEdit, though I wish that there was a keyboard shortcut to collapse/expand the current block of code. I also wish I could define language-specific syntax highlighting based on a regex or something like that. For example, I’d like to color the word “self” in Python differently from what Komodo Editor calls “identifiers”. I also wish that I could find a way to split the window vertically in Komodo. I’ll miss that feature of JEdit. It might warrant me keeping JEdit around for some things.

For the record, I also tried SubEthaEdit, Smultron, a couple of Vim plugins, XCode, and I downloaded and tried (and failed) to get SPE running, too. Komodo fit my brain best. I recommend it if you want some of the graphical goodness of an IDE but don’t want to lose your Vi key bindings. Enjoy!

Technorati Tags: , , , , , , , , , , , , , , , , , , , , ,

Social Bookmarks:



  1. Hi David,

    Nice article, I’m a little biased though as I am a developer on Komodo at ActiveState 🙂

    Just thought I’d add some comments to clarify a few of your points:

    * Keyboard shortcut to collapse/expand the current block of code
    There are commands for this “Expand Fold”, “Collapse Fold”, but you will likely need to assign a keybinding to it in Preferences->Editor->Key Bindings, as by default it is not assigned a key-binding.

    * Define language-specific syntax highlighting based on a regex or something like that.
    Whilst we do not provide this exactly, we do provide the ability to use User Defined Languages (UDL) which can perform custom syntax highlighting through regex and pattern matching.

    * I’d like to color the word “self” in Python differently from what Komodo Editor calls “identifiers”.
    We have a bug/feature request to do this for Komodo, but in the meantime you can add “self” to the kwlist in the file “”, located in your Komodo install directory.

    * I also wish that I could find a way to split the window vertically in Komodo
    You can split both horizontally and vertically in Komodo, try Window->Split View, and then “Rotate Tab Groups” for changing between horizontal and vertical.


    Comment by toddw — March 19, 2007 @ 12:31 pm | Reply

  2. w00t!! Thanks a bunch!

    I just did the vertical window split, and it works! However, that’s kind of a hack. It’d be nice if Komodo did this in the sort of canonical way, which is to just provide a ‘split vertically’ option in the menu (JEdit provides a toolbar button to differentiate. That works.)

    Thanks a million for the other tips as well. I’m going to go and further customize my environment now. 😀

    Comment by m0j0 — March 19, 2007 @ 1:09 pm | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

You are commenting using your 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

Blog at

%d bloggers like this: