Weird Looking: Abbreviation expansion in Komodo Edit

Abbreviation expansion in Komodo Edit

November 11, 2007 1:06pm (2 years, 8 months and 2 weeks ago)
So, I’ve been pretty jealous of TextMate lately.  I really can’t see spending $2,000 for a text editor (including the Mac), though.  This morning, I hacked up an attempt at TextMate-style abbreviation expansion in Komodo Edit, using a javascript macro.

Unlike other versions I’ve found, it doesn’t rely on the editor’s built-in word selection.  Instead, it grabs the text of the current line up to the cursor position and runs it through a regular expression.  There are several consequences to this:  It can be assigned to the tab key, since the regex eats whitespace.  I was also able to add generic HTML tag expansion, so that “<h1[TAB]” expands to “<h1></h1>”, with the cursor set between them.  I’m not sure if TextMate does this, but it probably should.

It also makes use of subfolders for different programming languages.  If two subfolders contain snippets with the same name, it’ll preferentially select the subfolder with the same name as the language of the current document.

TextMate can do some cool stuff Komodo can’t, like intelligently tabbing through different parts of a snippet that need customization.  I can’t see any way to do that in Komodo without making it a terrible hack (like inserting “TODO” wherever focus is needed, then tabbing to the next “TODO”).

Anyway, I’m fairly happy with it as is.  Now I just need to figure out how to generate code intelligence settings for our codebase at work.

Leave a comment


Accepts BBCode with a few enhancements.