12 Reasons
to Learn and Use
the vi Editor

There's an editor out there that programmers have been using to edit their programs for the last 24 years. It's called vi (say vee-eye) and it is it is quite powerful.

I use vi. Here are 12 reasons why:

  1. vi is universal.

    This is an editor that you can pretty much depend on being available in some form under any operating system.

    vi ships standard with Unix/Linux. There are several clones of vi available for Windows and the Mac that can be downloaded on the Internet.

  2. The shortcuts available under vi are truly short.

    Commands in vi are typically just a few keystrokes. To delete the word under the cursor is 2 keystrokes, dw. To delete all words to the end of the line is just 1 keystroke, D.

    Are shortcuts valuable? They are if you value your time and energy. I'm always in favor of anything that saves wear and tear on me.

  3. You can use vi to write web pages.

    That's right! The vi editor makes an excellent HTML editor. Why? Because you can use it in conjunction with your browser to check your work.

    All you need is a windowing systems such as Microsoft Windows or the X Windowing System under Linux. Now just switch back and forth between editing your document with vi and checking how it looks with the browser -- you'll need one window for each.

    Using vi to edit your HTML code will save you from having to buy an HTML editor such as Dreamweaver or Frontpage.

    Here's an added bonus! Because browsers are a free download, your HTML editor (vi) is never obsolete because your browswer is always up-to-date. vi is over 20 years old yet your HTML will be as up-to-date you want it to be because your choice of browser used to check your HTML is as up-to-date as you want it to be.

    It's a paradox but ancient and creaky vi is actually an insurance policy against out-of-date web technologies.

  4. You get vi for free or nearly for free.

    There are numerous vi clones available that are free. Perhaps the best of them is an editor called vim. Vim is charityware that is available on many platforms including Microsoft Windows and the Mac.

  5. It's one of the most powerful editors out there.

    The vi editor is very command rich. There's even a book written about all the commands -- Learning the vi Editor and Vim Editors, Seventh Edition from O'Reilly Press.

  6. You rarely have to take your hands off the keyboard to accomplish what you want to accomplish.

    Why do I care? Because I find using a mouse excessively wears on me after a while. Imagine eight hours of mousing around versus eight hours of being able to leave your hands on the keyboard and I think you'll see what I'm talking about.

    The vi editor is so rich in commands that an experienced vi user rarely takes his or her hands off the keyboard to accomplish what they wish to accomplish.

    Be aware that this combination of rich functionality and speed comes at a price: a steep learning curve. While learning vi is well worth it, expect to bumble around the first 3 days or so using the editor.

    As you become more proficient with vi, you'll be glad you stayed the course. The speed with which you will be able to accomplish things in vi is well worth it!

  7. The investment you make in learning vi now will pay handsome dividends in the future.

    The interface for vi is very stable. Created by Bill Joy (co-founder of Sun Microsystems) in 1978, vi has been around for 26 years now.

    Given the fact that it is the most popular Unix text editor, It will probably be around for at least another 26 years.

    You should always consider this before spending too much time learning a user interface: How stable is the interface? Will I have to learn a new interface before too long? What is the longevity of my investment of time in learning this interface?

  8. You can use Regular Expressions to do very powerful search and substitution operations.

    Regular Expressions make the work of finding text and replacing it with other text so much easier. The vi editor comes with powerful search and substitution capabilities built in.

  9. All the commands that come with your operating system are available in vi

    The operating system command I use the most is the Unix date command. I use date to time stamp my activities.

    If I have a special project going, I like to keep a journal my activities so that I have a running record. The date command allows me to time stamp my journal entries with the time of day, the day of the week, the day of the month, the month, and the year -- all with just 8 keystrokes -- :r !date.

    Whew! I'd hate to have to do that one by hand.

  10. Macro creation is very powerful in vi

    With the map command, vi allows a whole series of commands to be mapped to one keystroke. This takes a lot of the tedium out of repetitive editing.

  11. The vi editor creates very small files.

    I consider this a big advantage. I don't like creating a big huge file that is formated for printing when all I want to do is write a few notes to myself.

    My business planning is all done in vi. Since these plans are quite extensive, but don't involve any person other than myself, they don't really need to formatted to appear pretty on a printer. I appreciate the small footprint that these files make on my hard-drive.

    I've done a lot of writing in my lifetime but my entire life's output fits very easily on to one CD-ROM.

  12. Writing with vi is as close as you will ever come to writing in your own handwriting and still working on a computer.

    This advantage will be lost on people who've not done a lot of writing. On the other hand, those who've written much will know exactly what I'm talking about.

    For a writer who cares about great content, the more primitive the medium of expression that you use to record your writings, the better. There's something about writing in your own hand writing that brings out your creativity. The words just sort of flow onto the paper. It's difficult to explain but easy to experience.

    A typewriter is also a relatively primitive medium for recording one's writings.

    I read a remark once by an author of novels commenting on his friends who write novels. He said that he could tell which of his friends had gone to word processors and which ones had stuck with typewriters. The word processor users were easy to spot: Their writing had gone downhill.

    I know exactly what he's talking about. There's nothing quite like writing using a primitive medium -- a handwritten note, writing on a type-writer, or using a primitive email interface. Primitiveness tends to leave your writing uncluttered.

    Writing in vi gives one the same primitive experience that one gets when writing by hand or with a typewriter: There's nothing there to get between you and your writing.

    Why is primitiveness helpful? Because it leaves the writer no choice but to focus on content alone.

©Edward Abbott, 2004. All rights reserved. Revised May 5, 2004.

Questions or comments? Email me at ed@WebSiteRepairGuy.com.