Vim Tips Wiki
Advertisement
Tip 278 Printable Monobook Previous Next

created July 9, 2002 · complexity basic · author vim_power · version 5.7


One of the principles of effective text editing is moving around very efficiently.

Following are some pointers which may help you do that.

h move one character left
j move one row down
k move one row up
l move one char. right.
w move to begining of next word
b move to begining of previous word
e move to end of word
W move to begining of next word after a whitespace
B move to begining of pervious word before a whitespace
E move to end of word before a whitespace.

All the above movements can be preceeded by a numeric value. e.g. '4j' will move 4 rows down.

^ move to first non blank char of the line.
g_ move to last non blank char of the line.
0 moev to begining of line
$ move to end of line.
gg move to first line.
G move to last line.
nG move to "n"th line.
H top of screen.
M middle of screen
L bottom of screen
Ctrl-D move half page down
Ctrl-U move half page up.
Ctrl-B page-up
Ctrl-F page down.
Ctrl-o last cursor position.
'[a-z,0-9,A-Z] jump to the marker. (you can set a marker on line by :- m[a-zA-Z,0-9] and then jump back to it by '[a-z,A-Z0-9]
n next matching search pattern
N previous matching search pattern
* next word under cursor
# previous word under cursor.
g* next matching search pattern under cursor.
g# previous matching search pattern under cursor.

Comments

A very useful one for me is:

% : jump to the matching bracket {}[]()

Advertisement