Vim Tips Wiki
Tip 48 Printable Monobook Previous Next

created 2001 · complexity basic · version 5.7

You can save a lot of time when navigating through text by using appropriate movement commands. In most cases the cursor keys are not the best choice.

Here are some basic movement commands that may help you acquire a taste for more:

Move to the end of a word.
Move forward to the beginning of a word.
Move forward three words.
Move forward a WORD (any non-whitespace characters).
Move backward to the beginning of a word.
Move backward three words.
Move to the end of the line.
Move to the beginning of the line.
Move to the first non-blank character of the line.
Jump forward one sentence.
Jump backward one sentence.
Jump forward one paragraph.
Jump backward one paragraph.
Jump forward one line.
Jump forward 10 lines
Jump backward one line.
Jump backward 10 lines.
Jump to the top of the screen.
Jump to the middle of the screen.
Jump to the bottom of the screen.
10<PageUp> or 10<CTRL-B>
Move 10 pages up.
5<PageDown> or 5<CTRL-F>
Move 5 pages down.
Jump to end of file.
Jump x screen lines in direction (up,down) - useful for moving through a long, wrapped line of text.
Jump to beginning of file (same as gg).
Jump to line 50.
Set mark x at the current cursor position.
Jump to the beginning of the line of mark x.
Jump to the cursor position of mark x.
Return to the line where the cursor was before the latest jump.
(Two single quotes.)
Return to the cursor position before the latest jump (undo the jump).
(Two back ticks. This is above the Tab key on some keyboards.)
Jump to the last-changed line.
Jump to corresponding item, e.g. from an open brace to its matching closing brace. See Moving to matching braces for more.
Jump to the 1st column of the current line.
Jump to the 42nd column of the current line.


Jump to the place of last edit. Can be quite helpful while debugging or editing files.