« DBA Code of Ethics | Main | Oracle and the Dolphin »

May 3, 2006

The Helpful Code Editor (my switch to vi)

Pete and I got into this discussion yesterday about development environments and using an editor for coding that does work for you. The idea is that the more an editor can do for you the more productive you can be at writing code. I suppose this is things like syntax highlighting, bracket matching, auto-indenting, and syntax completion.

It was time to confess that a few months back I switched from emacs to vi (vim to be exact). According to Pete, I moved in the wrong direction on the path towards a more useful editor.

Why did I switch? I've been using xemacs, running remotely via X11, since the dawn of my tech career. I've been around many vi folks but always considered it a tool to be used for emergency sysadmin tasks when emacs wasn't available or overkill for the simple configuration edits needed. A few months back I managed a deveoper who was all vi, all the time, and I got to see first hand some of the cool stuff you can do in escape mode.

When I started at OpenAir there was some resistance to running xemacs. Development is done on a remote server so the obvious choice for an editor is something that can be run in a terminal. After some discussion about why there's no X I moved to emacs running in the terminal. At this point I realized that over the years I haven't really taken the time to learn how to use the power of keyboard commands in emacs. As I started to build up my emacs skills in keyboard mode I thought "while I'm having to overhaul my understanding of my preferred development tool, why not do it in a more drastic way and switch to vi?" So that's what I did.

Having had a conversation with Pete about vi and how unhelpful it is I decided the least I could do is take a little time this morning and build a .vimrc file that helps vim be a little more helpful than it is in it's default state. In poking around I found that there are lots of options, including auto indent, smart indent, show matching brackets, incremental search (for emacs-like, real-time search matching). I'm sure there are a ton more.

One complaint I had originally about vim is it's lack of cvs integration, no keyboard shortcuts for diff and commit. What I'm doing now is using the escape mode "execute a shell command" for this. I'm sure it's not hard to build an alias that would allow me to type one command and have vim execute the cvs commit.

I think the bottom line for me is that I was at a point where I had a good reason to learn a new tool. It just happens that the one that makes sense for my environment now is vim. Maybe someday I'll find a great IDE that is compelling enough to give a go and will mount my directory tree locally in order to use that kind of a desktop editor. Some folks have suggested Eclipse with a Perl plugin but I haven't seen it in action. Pete suggests TextMate which seems to be getting a lot of attention in the Mac development community. The story is compelling (develped by a Unix guy coming from emacs). Will have to look at it closer sometime.

Posted by mike at May 3, 2006 10:35 AM