Common vi/vim navigation commands

Here's a quick list of the most common vi and vim editor navigation commands I use every day.

Moving on the current line

Here are the most common navigation commands for moving around the current line:

0              Move to the beginning of the current line
$              Move to the end of the current line
5[RightArrow]  Move to the right 5 spaces
5[LeftArrow]   Move to the left 5 spaces

Moving around the current screen

Here are the most common navigation commands for moving around the current screen:

H              Move to the first line on the screen
M              Move to the middle line of the screen
L              Move to the last line of the screen

w              Move to the beginning of the next word
b              Move backwards to the beginning of the previous word

5[RightArrow]  Move to the right 5 spaces
5[LeftArrow]   Move to the left 5 spaces<
9[UpArrow]     Move up 9 lines
7[DownArrow]   Move down 7 lines

Moving around the file

Finally, here are the most common navigation commands for moving around the overall file:

1G             Move to the first line of the file
G              Move to the last line of the file
31G            Move to the 31st line of the file

[Ctrl]f        Move forward one screen
[Ctrl]d        Move forward one-half screen
[Ctrl]b        Move backward one screen

Of course there are a zillion other vi/vim navigation commands, but on a daily basis, these are the ones I use.

 

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.