Impossible tri-bar

Digital Phenomena - Your first stop for internet consultancy 
Advanced vi

Page 3 — More Moving Around

Last time, we learned that the four most basic moves - up, down, left, and right - can be mapped, respectively, to the k, j, h, and l keys. But punching in hhhhhhhhhhh gets tedious and is fairly inefficient. There are other shortcuts for getting around.

Typing "w" moves you forward word by word, with the cursor highlighting the beginning of each word, and "b" moves you back word by word.

To go to the end of any word you've landed on, type "e" and your cursor will move to the last character in the word. You can also glide between chunks of text: Typing ")" takes you to the start of the next sentence and typing "(" will move you back to the start of the sentence immediately before your cursor. Typing "]" takes you to the beginning of the next paragraph (handy for Web pages with lots of text) and "[" takes you - you guessed it - back. You can also use the line numbers to your advantage. Typing ":n," where n is the line number, whizzes you to the beginning of that line, as does typing "nG" (again, n is the line number).

One last note: You can also control where the cursor falls when you want to move from edit mode to insert mode. You already know that typing "i" allows you to insert text right where the cursor was; to insert text to the right of the cursor, hit "a" instead. Or, you can open a whole new line by typing "o."

next page»

|Home|About Us|Services|Search|
W3C validatedW3C validated CSSCompatible with all browsers