Luminary Perspective

March 20, 2006

Learning The vi Editor — The Right Way

Filed under: Motivation, Technical — Luke @ 9:08 am

I studied the vi editor yesterday. It is satisfying for me to take in information on various subjects, and even more satisfying when the study starts paying off in terms of time and effort saved. Some of the commands I found handy were dw, cw and ZZ. I used to always use :wq or :q! to quit when I finished with a file, but now I know that ZZ and ZQ available, and much easier to type.

What I really appreciate (maybe it comes with being INT šŸ˜› ) is that the paradigm of vi is based on the idea that an alphanumeric keyboard with two meta keys (shift and control) is sufficient. I am just getting myself weaned off of the “return”, “escape”, and “backspace” mentality. CTRL-M, CTRL-C, and CTRL-H take care of each of these nicely, while h, j, k, and l guide the cursor through the file, eliminating the need for arrow keys. The end result is less stretching of the fingers and less distraction.

If you ever have any question, chances are the gap in your knowledge can be fixed in a few minutes by typing :help . If this doesn’t give the result you are after, try searching for whatever with the forward-slash. (You’ll know all about this after going through vimtutor.) Once you have learned vi, it is hard not to like it.

M Paradigm
O  no non-alphanumeric needed : more simple once you learn it
R Problems
E  none once you learn it : easy to quit before mastering
V How To
I  vimtutor : use :help and / : learn the control and shift-keys


  1. My favorite little known vi command is qa. it records a macro. when you are done I think it is qq. then use @a to apply the macro. its gret for multiple complex changes. you can have lots of macros, I just always use a. you can do qb/@b etc.

    Comment by Micah — March 21, 2006 @ 5:54 am

  2. Awesome! I always wondered what the q stuff was about. So it records whatever you type directly into a buffer, then lets you retrieve it with @a or whatever. Neat!

    Comment by Luke — March 21, 2006 @ 7:30 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: