Basic vi knowledge

vi is included in almost every GNU/Linux or UNIX distribution. "vi" is a truncation of the word "visual". vi is different from most editors in that it has different so-called modes. When you start vi, you are in NORMAL mode. Here every key has some special function. For example, pressing 'x' deletes the character under the cursor. Beginners will start off preferring the INSERT mode; you enter it by pressing 'i' in NORMAL mode. Here letters are letters, backspace is backspace etc – like in any old editor. This is a kind of "safe" mode for beginners, as, unlike in NORMAL mode, keys don't do unexpected things. When you have made the changes you want, switch back to NORMAL mode by pressing . You can always return to insert mode by pressing i. Now you will want to do some special things such as saving.

Here are some command you should know:

:w <ENTER> write file
:wq <ENTER> write file and quit
:w FILENAME <ENTER> write file as FILENAME
:q <ENTER> quit
:q! <ENTER> quit witdout saving

Even in NORMAL mode, you can use the arrow keys to navigate, but this always means moving your hand from the letters to the arrow keys and back, resulting in some latency. On laptop keyboards, this is especially inconvieneant. Instead, vi offers the following movement keys:

  k up  
h left   l right
  j down  

On most keyboards, these keys are under a touch typist's right hand
and thus very accessible. By the way, vi is a perfect editor to learn
typing with ! These keys can be memorized in different ways. h and l are the furthest left and right of the set; the letter j
looks slightly like it's pointing downward and the key usually has a little stud (for finding the key when touch typing) at the bottom.

To learn more about vi editior read the vi survival guide

6 comments so far

  1. tamtun on

    Nice site. Thank to work…

  2. alhrik on

    Nice site. Thank to work…

  3. edric on

    Perfect pages… tnx

  4. isenham on

    Nice site. Thank to work…

  5. berwick on

    thank you for your work

  6. Roobina on

    It is very useful and helpful site..

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: