Vim Navigation Basics
Master Vim's modal editing system with hjkl movement, word motions, line jumps, and essential commands. These shortcuts work in Vim, Neovim, and Vim plugins for VS Code, IntelliJ, and other IDEs.
Basic Movement (hjkl)
Arrow Keys Alternative
In Normal mode, use h (left), j (down), k (up), l (right).
h j k l → ← ↓ ↑ →
Word Motions
w moves forward to the start of the next word, b backward, e to the end of the word.
w → next word start
b → previous word start
e → word end
Line Jumps
gg jumps to the first line, G to the last line. Use 0 for line start, $ for line end.
gg → first line
G → last line
0 → line start
$ → line end
Essential Commands
Vim's power comes from combining operators with motions. These commands work in Normal mode:
dd — delete (cut) entire line
yy — yank (copy) entire line
p — paste after cursor
u — undo last change
Ctrl+R — redo
x — delete character under cursor
. — repeat last command
Combine operators with motions for precision: d3w deletes three words, y$ yanks to end of line.
Search & Visual Mode
Search
Press / to search forward, ? backward. Use n for next match, N for previous.
/pattern → search forward
?pattern → search backward
n / N → next / previous match
Visual Mode
Press v for character-wise selection, V for line-wise, Ctrl+V for block selection.
v → visual character mode
V → visual line mode
Ctrl+V → visual block mode
Modal Editing
Vim's efficiency comes from separating navigation from editing. Understanding modes is essential:
- Normal mode — Default mode for navigation and commands. Press Esc to return here.
- Insert mode — For typing text. Enter with i, a, o, etc.
- Visual mode — For selecting text. Enter with v, V, or Ctrl+V.
- Command mode — For ex commands. Press : to save (
:w), quit (:q), or substitute (:%s/old/new/g).
The key to Vim mastery is keeping your hands on the home row and using Normal mode for all navigation. This eliminates reaching for the mouse or arrow keys.