Crossing Battle Lines

Generally, when I’m doing non-.NET programming, I use either Vi or Notepad++ as my text editor. There was a time when I was using Notepad++ for nearly everything, but the lack of coherent syntax highlighting (especially for “mixed” files containing ColdFusion–both tag- and script-based–and Javascript) and a busy search UI made Vi a bit more attractive. I ditched Notepad++ completely when I learned a few more useful Vi keystrokes (indenting blocks of text, for example). I still hate the swap file litter Vi leaves behind (yes, I know I could change that), but aside from that, it was powerful enough for my needs.

I started to play around with the latest version of Eclipse again, and promptly realized why I left it: it’s HUGE, the keybindings for common actions bear no resemble to other editors (my biggest gripe? F3 doesn’t, by default, repeat your last search. There is not another GUI-based editor–or even program!– on Windows that doesn’t follow this convention). There are nice ColdFusion and Javascript plugins, but CFEclipse ignores the editor preferences you’ve configured, and it’s intellisense is a bit too enthusiastic.

Then I saw that Emacs 23 was released. I’ve tried Emacs in the past, but never really committed to learning it, and therefore never got it. Wisely, I never blamed Emacs for my own shortcomings, but I convinced myself that I couldn’t commit the time to learn it well enough to use it. This time, however, I thought I’d do it right. After some time just playing with text files, I moved on to configuring the environment to my liking (I’m a fan of light-on-dark color schemes). Doing these things in Emacs requires editing init.el, which is a Lisp program masquerading as a configuration file. I found the basis for a twilight theme, then added that to my init.el. Taa-daa! Twilight theme. Then I needed to change the tab width.

(setq default-tab-width 4)

Done. After a few more minor tweaks, I was ready to dive in modes, Emacs’ syntax highlighting (among other things) system. The general consensus is that the current ColdFusion mode available kinda stinks, so everyone just suggests using html-mode. Once downloaded, I instructed html-mode to treat ColdFusion files like HTML:


(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cfm$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cfmInc$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cfc$" . html-helper-mode) auto-mode-alist))

Done. Hmm, how about Javascript? I downloaded Steve Yegge’s js2 mode, updated init.el, and I was off.

So, here I am, several days later. How goes it? Well, I no longer have to look at a cheat sheet to do simply stuff like copy (C-space to highlight, M-y to copy), paste (C-y), save (C-x s), and cycling through buffers (C-x b) (I’ll leave it up to you to discern what those characters really mean). Opening files is still a bit laborious (I’ve taken to just dragging files into the editor, so I really need to figure some sort of project management, which I know exists). I’m not quite as productive as I might be Vim, but I’m getting there. I do feel comfortable enough, however, to ditch Notepad++ and Vim for my daily editing needs.