February 2006


30 years ago, in 1976, Bill Joy (co-founder of Sun Microsystems) released vi — a visual text editor for an early version of BSD. 15 years ago, Bram Moolenaar released vim (vi improved). Today I finally decided to learn about vi(m).

vi(m) is the default text editor found on virtually every UNIX system in existance today. Even Mac OS X has vim installed by default. After using *nix systems for about 6 years now, I never really spent the time to learn about vi. Sure I could (poorly) use it to edit some text files in a pinch (I knew how to load a file, insert some text, save and quit) but for any console editing tasks, I found myself reaching for the much more user-friendly nano (hey, it has the few commands listed at the bottom of the screen!). However, there is very few software applications that are still being used (and preferred) for over 30 years. At the time vi was released, Microsoft was being run out of a dorm room and Apple had yet to exist.

For many years, I simply disregarded vi(m) as a unix relic that had no (major) significance to newcomers. However, curiousity got the best of me. Every once in a while, a debate about text editors occurs that brings up vi(m). LinuxQuestions.org is currently during its annual poll and once again, vi(m) is included on the list. Others have stirred up the vi(m) vs emacs debate. Needless to say, given the re-occurance of vi(m) and its standard place as the editor-of-choice for default UNIX installs, I figured I’d spend some time learning it.

I ended up installing vim on my FreeBSD system. I headed over to the vim website and was happy to find the vim book available in PDF format. I was shocked when I opened it and noticed it was 572 pages! Yikes! 572 pages for a text editor??!? Even my tome on the FreeBSD operating system was only 565 pages. Anyways, needless to say, I have yet to read all 572 pages, but after reading ~50 pages (the pages are not very text heavy so its not THAT bad.) I can say that I am impressed.

What is cool about vim? Well for starters, it is very keyboard centric. As a result, I am able to control the application without a mouse, which is nice. In addition, it is not menu driven (read: use of control key combinations, extensive use of arrow keys, etc..) and many of the commands are one or two characters (ie press d for delete, i for insert, v for visual mode, w to move to the next word, etc..). Infact, it even assigns hjkl to left/down/up/right for cursor movement so moving your hands from home row are not necessary (focus on efficiency :)

In addition to this, it provides easy access to search functions. I can simply hit a forward slash (/) and type in a search term and it will highlight the search term throughout my document. I can also do a search/replace without the need to open a dialog box and enter text in different text fields (ie: :%s/cat/dog/g to change all “cat” to “dog”). In addition to this, it has full support for regular expressions so its possible to do complex search and replace operations (regular expressions also has its own equally impressive tome).

It also allows me to tap into many of the command line tools available in Unix. For example, I can mark a section of my document and run it through the Unix “sort” command. Or perhaps I am reviewing a log file.. I could do a search in vim, find the entries I need and simply mark and filter it to the “sendmail” command to email it directly (compared to cutting and pasting, opening up an email client, creating a new email, pasting it in, etc..).

conclusion.. text is one of those things that we deal with on a daily basis. Unfortunately, as I am learning, the tools available make working with text much more cumbersome than it needs to be. vi(m), with its 30 year focus on text editing seems to have been refined to doing the task particularly well. No wonder those who have spent the time learning about the power of vi(m) have grown to prefer it even to the latest and “greatest” text editors available. Here’s to the next 520 pages of the vim manual :)

After running the FreeBSD 4.x series on my desktop for the last 2.5 years, it was time to upgrade. Instead of going with the official FreeBSD 6.0 release (as I would for a server), I elected to try out PC-BSD, a desktop centric version of FreeBSD 6.0.

I have been using PC-BSD for about a week and its great. I have full use of the FreeBSD 6.0 operating system but with the huge benefit of being able to install and get to a configured desktop in less than a half hour.

Perhaps the big selling point of PC-BSD is its PBI software distribution model. A PBI is similar to a setup file on Windows or perhaps a .DMG/package file on Mac OS X. Simply download, click, type in the administrative password (to avoid rogue/malicious software from installing system-wide software) and it installs. Unlike Windows setup files, the installer is standardized so once you install one piece of software, you can use the same method for other software. In addition, I *believe* software installed with the PBI format will auto-update when new versions are released through PC-BSD’s system update utility. Very nice for centralized software management.

PBIs have a few downsides. First, each software package is kept in its own separate folder and is designed not to share dynamic libraries with other software. While this is great for ease of installation/removal, it does equate to the use of more system resources as duplicate libraries may be loaded into memory/stored on the hard drive. Second, as of right now, the PBI software library is not fully populated. While it does have most of the popular software items (such as firefox, openoffice.org, thegimp, wine, etc..) I found myself quickly dipping back into the ports system to install other software. As time goes on, I believe more tools and commiters will be working on the PBI format so more software will be available and perhaps it can start making better use of code libraries (concurrent versioning perhaps?)

Overall I am quite pleased with my new desktop setup. The system has been performing very stable as expected from FreeBSD. The ability to quickly install new versions of software via the PBI system is very useful. Two thumbs up! PC-BSD takes the stability of FreeBSD and the flexibility of the KDE desktop environment and combines them in an easy to install and maintain system — whats not to like? :)