ActiveBlog

Komodo's Vi Emulation
by Troy Topnik

Troy Topnik, January 6, 2011
Komodo IDE - Vi Key Bindings

It feels like I'm making Todd do all the work these days. From the man who brought you Vi emulation in Komodo, here's a screencast about Vi emulation in Komodo.

Some back-story...

Way back in the Komodo 3.5 days I was writing and editing almost everything I worked on in my favorite editor: Vim. It seemed a bit perverse to be writing Komodo documentation and not actually using Komodo, so I made the switch and reluctantly gave up finger-friendly modal editing.

Until July 11, 2006, the momentous day when Todd Whiteman's Vi emulation "dark project" landed in an Alpha build of 4.0. I'd been begging for this feature for years and suddenly, there it was. Overnight I was transformed from a reluctant eater of dog food into a Komodo fanboy.

I won't regurgitate the many merits of Vi and Vim, there are lots of excellent resources for that written by true Vim gurus. It's worth talking about how this is emulated in Komodo though; it's not just key bindings.

Key Bindings vs. Modal Editing

Komodo had always had completely customizable key bindings. Recognizing that everyone has very personal tastes in this department, we gave Komodo an interface for examining, modifying and saving key binding preferences. With this, we could offer an Emacs-like key binding scheme and a more "native" key binding scheme for each operating system Komodo runs on.

We needed more than that to give people the Vim experience though. Vi emulation added modes for navigation and editing, input, visual selection and a command line interface. As a bonus, key bindings in all modes (and for switching between them) were configurable and savable using the existing interface.

Vi Commands

Something that isn't covered in the screencast is the magic "Vi Commands" folder in the toolbox. If you add a folder to your toolbox (or the shared toolbox, or a project toolbox) with that name, you can run them by name from the Vi command line interface - the field at the bottom of the buffer that opens when you hit ":".

Visit www.activestate.com/komodo-ide to check out all Komodo IDE’s features and to download a 21-day trial today.

Subscribe to ActiveState Blogs by Email

Share this post:

Category: komodo
About the Author: RSS

Troy Topnik is ActiveState's technical writer. After joining ActiveState in 2001 as a "Customer Relationship Representative" (AKA Tech Support), Troy went on to lead the PureMessage Enterprise Support team before moving on to a technical writing role in 2004. His talent for describing software for new users stems from his difficulty understanding things that developers find obvious. He has a Bachelor of Music from the University of Victoria.

Comments

5 comments for Komodo's Vi Emulation
Permalink

Thanks for making vi editing part of the core package. The one thing I feel it is missing is text objects.

Permalink

So cool. I find myself all the time wishing for vi duplication commands. Now if only the key-bindings would take effect without having to restart. Thanks for this great screencast and for making vi key-bindings part of the package.

Permalink

Thanks. FWIW, the key bindings do usually take effect immediately. There can be odd behavior if you have tools with key bindings that conflict with the new scheme, which is why that dialog box suggests a restart.

Permalink

The vi keybindings are decent, but highly incomplete. The most frustrating instance to me is that the "repeat previous command" key (period) does not take into account deletions. So if I hit "i", backspace 3 characters, type "foo", and then hit esc, then when I next hit ".", Komodo Edit will insert "foo" at the cursor without deleting three characters back. This destroys the ability to easily repeat replacements of text without breaking out s/../../ commands.

Permalink

Thanks. There's a bug that includes this here:

http://bugs.activestate.com/show_bug.cgi?id=46878

If you find anything else that's missing please add it there.