I still can’t stand vi

I’ve been a fan of nano for as long as I’ve been editing a lot of text files remotely (soon to be approximately three years now). The learning curve was fairly gentle, and I gradually memorized the shortcuts I found to be useful. It was a good fit.

With any programming I do, I often need to make small, frequent edits to files– this is just my style. I do the majority of my actual coding in Eclipse and/or with programs like gedit, then paste files into nano or FTP them to the remote host if necessary. Obviously I can’t compare Eclipse to nano, but strictly speaking about gedit, I’ll freely admit that I’ve always been much more comfortable with GUI text editors than with nano. Of course, once the file is on the remote host, I test the results, make small modifications to my file(s) via SSH, and re-test. I generally don’t bother to go back to the IDE and/or GUI unless I’m really stumped or I have to do some major refactoring.

A few months ago, I started an internship in which I develop software and web applications for embedded Linux modules. I was, of course, right at home with the job description, but yet I still feel a twinge of horror remembering the first day I worked on some PHP files on the development kit.

The modules we use are able to re-flash their permanent storage by retrieving a filesystem image from a host computer via TFTP, but writing to flash memory takes forever. It’s way too slow if you only need to change one line of code. Alternatively, you can FTP just the file you want to change, overwriting the old version of the file on the module, but that’s still way more trouble than I want to go through for one line of code. And so, there in my telnet session, I fired up good ol’ trusty nano… or attempted to. That’s when I found out that the only text editor installed by default on the modules is vi. The manufacturer’s prepackaged binaries do not include nano, and I was (and still am) too n00b to cross-compile it for ARM.

I had run into vi once or twice before. My wireless router (which runs BusyBox, just like our modules), also suffers from nano-scarcity. I don’t remember if that in particular was why I had used vi before, or if it was due to something unrelated, but in any case, I was not impressed with vi. I heard lots of great things about its efficiency, but I never had the patience to learn to use it. When the ratio of time spent reading documentation and memorizing key combinations to time spent actually getting stuff done reached some ridiculous upper bound, I just gave up. And in my situation back then, I was okay with that. It was like learning to fly a plane just to get to the grocery store across town. I really didn’t need it.

But later I did, as previously mentioned. So, grudgingly, I learned some vi. Specifically, I learned the key combinations to enter insert mode, writeout, and quit. That was all I needed at first, but later I found it convenient to delete all lines in the file and paste in the latest revision from a GUI. To vi’s credit, all this only takes a handful of keystrokes. I can’t seem to disable the auto-indent feature in the default settings, so it’s a little annoying to have to type :set noai every time I open a file, though I guess I can live with that. But I can’t justify learning any more commands. I’m just not convinced that it’s really worth the effort. And thus, my uneasy situation with vi continues.

Oh, and apparently, using vi almost exclusively for a few months has erased my muscle memory for nano. This feels like when I switched to Dvorak and for a few weeks was not able to type faster than 3 WPM in QWERTY nor Dvorak. I suppose I could now, as I did then, steady my resolve and embrace the overwhelming learning curve. We shall see.

This entry was posted in Programming, Thoughts and tagged , , , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

One Comment