When I started at Laszlo over two years ago, there were two kinds of engineers at the company, those who used emacs and those who used vi — roughly divided by coasts, with emacs in the east and vi on the left. I had thought that no one would use vi by choice, that it was only used when people were stuck with no other option, remotely logged into a server. I had learned to use vi a bit in college. Just enough to hobble around: dd, d$, cw, :q, :w, :q!. I was horrified. Who thought up these bizarre key bindings? I left college for jobs writing desktop applications, secure in my certainty that this appalling example of software engineering would surely die a quiet death, drifting into historical obscurity.
Lo and behold! vi was alive and well in San Francisco, installed on desktops where a perfectly usable GUI editor might be found. I was in for a bit of culture shock, and it ran in both directions. Adam Wolff asked in my interview what my favorite editor was. I told him I didn’t have one. He was taken aback, but I had been working for over ten years in an environment where my choice of compiler dictated the editor I used — from Think C in 1990 to Visual C++ in 2002. I was impressed with Adam, but I couldn’t believe that someone so apparently intelligent and savvy about user interface design and development could possible choose vi as an editor. I took the job, but remained puzzled.
Seeing Adam in action, my perspective on vi was forever changed. At Laszlo, the engineers who give presentations have this knack of illustrating the LZX language by writing an application from scratch starting with a blank page. It is impressive and fun to watch. When Adam does this it is performance art. His hands never leave the keyboard. His attention is focused on the audience and the task at hand. Using vi’s folding features, he can keep key parts of the application on screen, even in a small window. Watching him use vi, it looked easy and fun. I saw that there was method behind the madness of the seemingly bizarre key bindings. It is geared to optimizing your finger positions on a good old qwerty keyboard.
Despite these apparent benefits, I opted out of that learning curve. Instead I settled into happy coding for with IDEA from IntelliJ, until a couple of months ago when my world slowed to a crawl. I sadly discovered that my IBM laptop had misplaced half its RAM. I could no longer run tomcat, Firefox, IE, Thunderbird, and IDEA and get anything done. While I awaited a replacement computer, I discovered that if I ran tomcat, Firefox, and vi — just the bare necessities, I would stay just under 512 MB of RAM. Even though I was more proficient in Notepad and I had deadlines looming, I settled in for a steep learning curve.
I am fortunate to be immersed in a particular flavor of geek culture where people enjoy sharing know-how. In fact, the vi-o-philes in the offices were downright delighted to help me configure my vimrc or teach me new commands while coding together. Scott Evans even bought me my very own vi reference mug.
As it turns out, there are patterns in the key combinations that make it so that once you learn all the variations on one command, you know how to use a whole lot of them. So, with my knowledge of dd (delete line), d$ (delete to the end of line), cw (change word), I learned that dw means delete word. Then when I learned about yy (to ‘yank’ a line into a buffer to later ‘put’ with p), I automatically know yw and y$. When I learned how to delete 3 lines with 3D, I also learned what 3Y means. Also, vi has gotten better since I was in school (I use gvim on Windows which has menus and even lets you use the mouse!)
This is Geek User Interface design, as opposed to the “human” interface design of the Graphical User Interface. It rewards people who are pretty good at remembering arbitrary, but useful sequences of letters.
This experience reminds me of Doug Engelbart and his bicycle analogy. “The tricycle may be easier to learn and use, but it is hard work to travel even a short distance. Riding a bicycle calls for considerably more skill, with bumps and bruises expected as one learns, but the effort-to-performance ratio is dramatically higher. The high-performance knowledge workers of the future, as perceived by Engelbart, are expected to be very skillful.” (2F1B)
So I’ve got a new machine, which is has enough RAM for a GUI editor, but I’m still using vi. I don’t know whether I’ll stick with it, but I’m pleased that the common commands are now etched into my muscle memory. If I decide to leave vi for a while, I can always go back, like riding a bicycle :) Sometimes I miss an interactive tree-view to navigate XML hierarchy. I find that grep is no match for a really nice multi-file search UI, but I would miss the simplicity of ‘/’ for searching within a file. I plan to install Eclipse with the latest version of IDE4Laszlo and give that a whirl. We’ll see.
emacs still lives on the west coast in Laszlo Studios!! Even though most of the old guard uses vim, there’s still a strong emacs contingency. I must admit that it is beautiful to see folks editing when they’re on a roll with vim.
Ah, the joys of ‘vi’…
Back when I was on the C++ Standards Committee, I used a Psion handheld computer as my primary traveling machine and had a port of ‘vi’ running on it that I used to edit the troff pages that generated the ISO/ANSI draft documents.
Admittedly I used the Psion word processor for taking meeting notes (I was secretary of J16 for three years)…
I’ll be interested to read how you get on with Eclipse. I use it for all my day-to-day coding these days. It has its quirks but overall it’s a good, solid IDE.
gvim is great :-) Make sure to grab some of Adam’s helpful aliases, too, like the one that will make gvim’s cwd the same as the dir of the file your editing.
Hi-ya Sarah,
I just thought I would do you the disservice of telling you that you were featured in yesterday’s blog of the day at:
http://syndicatescape.com/bigblogzoo/
take care
kent
Everyone has a favorite stupid vi trick. You didn’t ask, but I can’t stand it. I have to share mine: recorded buffers.
qa = start recording all my keystrokes in buffer a
esc (if you’re in insert mode) q = stop recording my keystrokes.
Then there’s the joy of having all those buffers recorded:
@a = run the keystrokes in buffer a.
32@a = run the keystrokes in @a 32 times.
I know some explanations don’t travel well without demonstration (or everyone would be in love with vi — right?) so if I explain badly, ask Scott what I’m babbling about. He knows.
Now we have to get you using Pine and the transformation will be complete.
mmmm…… pine.