home | lab | find me | science | publications | software | toolbox | site map


Text editors with a sense of humor



2005-09-30

I am mostly a ViM user, but I drop to kwrite or any other KDE-related editor (such as kate) when I have to do tiny adjustments over FTP, because ViM, for all its greatness, fails miserably there (although the tenacious user can get it to work). Of course SSHing is almost always an option but then, most servers don't offer ViM and using plain vi or emacs/xemacs is a pain. Vi/ViM are quite odd though. The first time I opened a ViM session I couldn't even get out without closing the whole terminal (a macosx 10.1.4 terminal back then), and same story for emacs.

Initially I coded in TextEdit.app. Then I moved to Haxial's TextEditor, which at least remembered the line position after closing/reopening a file (actually after I suggested the guys to code that in), and warned me when a file was not saved with a little yellow 'danger' triangle. After going over a thousand lines the code was no longer workable, so I switched to JEdit, a java-based multipurpose text editor with some impressive capabilities. In JEdit I got to learn how to use folds and to navigate a java source file by hoping through its methods and constructors on a mouse-clickable list (some quite useful plugin whose name I can't remember).

But I was not satisfied. I found myself complaining; writing code was sluggish, crude, too much typing. Oh, and my wrists started to hurt a lot, and I acquired some nasty wrist-bending habit that still creeps in sometimes. So I stated reading online about what was the best text editor out there and why, and I found people reasoning in a way that kept me saying "aha, aha, precisely", and so I tried emacs. I could never get the emacs menus to work and/or I could never remember the endless control+x control+something keyboard shortcuts that were supposed to bring me the menus, so I switched to xemacs, which after figuring out how to install XDarwin through fink (well, mostly through the FinkCommander.app), gave me a nice GUI-based editor with the power-editing of emacs. Not too bad, but still too much mouse. I realized the more I used the mouse the more my wrists hurt, so I was getting to increasingly rely on keyboard shortcuts.

Finally I read somewhere about a guy who went through a progression like me and ultimately settled on ViM. While initially reluctant, I followed a few guidelines -basically how to open/create a file, save it, insert and navigate its text, and how to call up the help utility. On this last one, just reading the help on how to edit the text got me to drool. Finally a text editor that is an aid to writing and not an impediment! Finally multiple paste buffers at the type of a key! Finally amazing cutting/pasting/text-reproducing/text-replacing like none ever seen before, and also the ability to switch through many opened files by typing any part of its name! And in addition usable over SSH! A text editor for everything! A text editor that makes sense.

ViM is so amazingly powerful I don't think I even use 1/10th of its editing capabilities after 2 years of intensive use. I keep learning on it almost every time I use it. Give it a shot, I have written some tips on it if you'd like to have a look at what it can do. And I forgot: with ViM macros are trivial. By which I mean that one can very easily record any sequence of commands under a specific name and then execute it by calling it as many times as desired. It enables a power search-and-replace, for one thing, as I have never found in any editor. Of course one can always use the regular expression-based substitution command, but there are things that must be done manually and there is where macros come in handy.

By the way emacs has it's good uses too: whenever I feel my brain is powering down, I can give a shot to gomoku, a built-in 5-in-row game. Just type emacs, then ESC+x, then gomoku, return. Navigate with arrows or h-j-k-l ViM-style, and 'x' to mark a spot. Try to beat it if you can. My last game, tonight:

Gomoku



Last updated: 2012-05-08 11:10 Zurich time. Copyright Albert Cardona.