Vim Keyboard Reference
Complete QWERTY keyboard reference for Vim commands in Normal mode. This covers movement, editing, searching, and common operations.
Essential Modes
| Key | Action |
|---|
Esc | Enter Normal mode (from Insert/Visual) |
i | Insert mode (cursor before character) |
a | Insert mode (cursor after character) |
I | Insert at start of line |
A | Insert at end of line |
o | Insert new line below |
O | Insert new line above |
v | Visual mode (character select) |
V | Visual mode (line select) |
Ctrl+v | Visual mode (block select) |
: | Command mode |
/ | Search forward |
? | Search backward |
Movement - Home Row (HJKL)
↑
k
← h l →
j
↓
| Key | Action |
|---|
h | Move left 1 character |
j | Move down 1 line |
k | Move up 1 line |
l | Move right 1 character |
0 | Move to start of line |
$ | Move to end of line |
^ | Move to first non-blank character |
g_ | Move to last non-blank character |
Word Movement (Top Row - QWERTY)
| Key | Action |
|---|
w | Jump to start of next word |
b | Jump to start of previous word |
e | Jump to end of word |
W | Jump to start of next WORD (ignores punctuation) |
B | Jump to start of previous WORD |
E | Jump to end of WORD |
ge | Jump to end of previous word |
gE | Jump to end of previous WORD |
Line Movement (Left Side)
| Key | Action |
|---|
gg | Jump to start of file |
G | Jump to end of file |
[line]G | Jump to specific line (e.g., 69G) |
Ctrl+g | Show current line number |
) | Jump to next sentence |
( | Jump to previous sentence |
} | Jump to next paragraph |
{ | Jump to previous paragraph |
| Key | Action |
|---|
Ctrl+f | Scroll forward (page down) |
Ctrl+b | Scroll backward (page up) |
Ctrl+d | Scroll down (half page) |
Ctrl+u | Scroll up (half page) |
Ctrl+e | Scroll down 1 line |
Ctrl+y | Scroll up 1 line |
zt | Center cursor at top of screen |
zz | Center cursor in middle of screen |
zb | Center cursor at bottom of screen |
Deletion (D-Row)
| Key | Action |
|---|
x | Delete character under cursor |
X | Delete character before cursor |
dw | Delete to end of word |
db | Delete to start of word |
dd | Delete entire line |
d0 | Delete to start of line |
d$ | Delete to end of line |
dG | Delete to end of file |
dgg | Delete to start of file |
d[n]j | Delete n lines down (e.g., d3j deletes 3 lines) |
D | Delete to end of line (same as d$) |
Change (C-Row - Insert After Delete)
| Key | Action |
|---|
cw | Change word (delete + insert mode) |
cb | Change to start of word |
cc | Change entire line |
c0 | Change to start of line |
c$ | Change to end of line |
C | Change to end of line (same as c$) |
s | Substitute character (delete + insert mode) |
S | Substitute entire line (same as cc) |
Copy/Paste (Y-Row and P-Row)
| Key | Action |
|---|
yy | Copy entire line |
yw | Copy to end of word |
yb | Copy to start of word |
y0 | Copy to start of line |
y$ | Copy to end of line |
yG | Copy to end of file |
ygg | Copy to start of file |
p | Paste after cursor |
P | Paste before cursor |
]p | Paste with auto-indent |
[p | Paste before with auto-indent |
Undo/Redo (U-Row)
| Key | Action |
|---|
u | Undo last change |
U | Undo all changes on line |
Ctrl+r | Redo |
g- | Go to older text state |
g+ | Go to newer text state |
Find/Replace (F and R)
| Key | Action |
|---|
/pattern | Search forward |
?pattern | Search backward |
n | Next search result |
N | Previous search result |
* | Search word under cursor forward |
# | Search word under cursor backward |
g* | Search partial word under cursor forward |
g# | Search partial word under cursor backward |
:s/old/new/ | Replace on current line |
:s/old/new/g | Replace all on current line |
:%s/old/new/g | Replace all in file |
:%s/old/new/gc | Replace all with confirmation |
Selection - Visual Mode (V)
| Key | Action |
|---|
v | Start visual selection (characters) |
V | Start visual selection (lines) |
Ctrl+v | Start visual selection (block) |
o | Jump to other end of selection |
aw | Select word (in visual or operator) |
ab | Select block with brackets |
at | Select tag block (HTML/XML) |
iw | Select inside word |
ib | Select inside brackets |
it | Select inside tags |
Operators (Can Be Combined with Motions)
Pattern: [operator][motion]
| Operator | Action |
|---|
d | Delete |
c | Change (delete + insert) |
y | Yank (copy) |
> | Indent right |
< | Indent left |
= | Autoindent |
gU | Uppercase |
gu | Lowercase |
~ | Toggle case |
! | Send to external command |
Examples:
d3w = Delete 3 words
y2b = Copy 2 words backward
gU5j = Uppercase next 5 lines
<3j = Indent left 3 lines
=ap = Autoindent paragraph
Numbers and Repeats
| Key | Action |
|---|
. | Repeat last command |
[n] | Prefix any command with number (e.g., 5j = down 5 lines) |
[n]dd | Delete n lines |
[n]yy | Copy n lines |
[n]p | Paste n times |
[n]. | Repeat last command n times |
Marks and Jumps (M and G)
| Key | Action |
|---|
m[a-z] | Set mark (e.g., ma sets mark 'a') |
'[a-z] | Jump to mark (e.g., 'a jumps to mark 'a') |
'' | Jump to previous position |
Ctrl+o | Jump to previous position (older) |
Ctrl+i | Jump to next position (newer) |
g; | Jump to previous change |
g, | Jump to next change |
Increment/Decrement (Numbers)
| Key | Action |
|---|
Ctrl+a | Increment number under cursor |
Ctrl+x | Decrement number under cursor |
Case Operations (G-Row)
| Key | Action |
|---|
~ | Toggle case of character |
g~w | Toggle case of word |
gUw | Uppercase word |
guw | Lowercase word |
gUU | Uppercase line |
guu | Lowercase line |
Line Operations (Blank Row)
| Key | Action |
|---|
J | Join lines (delete newline) |
gJ | Join lines (no space) |
[count]J | Join n lines (e.g., 3J joins 3 lines) |
Indentation (Q-Row, Z-Row)
| Key | Action |
|---|
>> | Indent line right |
<< | Indent line left |
== | Autoindent line |
>[motion] | Indent selection |
<[motion] | Unindent selection |
=[motion] | Autoindent selection |
Tab | Insert tab (in insert mode) |
Shift+Tab | Delete tab (in insert mode) |
Folding (Z-Row)
| Key | Action |
|---|
zf[motion] | Create fold |
zo | Open fold |
zc | Close fold |
za | Toggle fold |
zR | Open all folds |
zM | Close all folds |
Command Mode (Colon)
| Command | Action |
|---|
:w | Save file |
:q | Quit |
:wq | Save and quit |
:q! | Quit without saving |
:e [file] | Open file |
:bn | Next buffer |
:bp | Previous buffer |
:bd | Delete buffer |
:vs [file] | Open file in vertical split |
:sp [file] | Open file in horizontal split |
:set number | Show line numbers |
:set relativenumber | Show relative line numbers |
:set spell | Enable spell checking |
:help [topic] | Open help |
Window Navigation (Ctrl+W)
| Key | Action |
|---|
Ctrl+w h | Move to left window |
Ctrl+w j | Move to bottom window |
Ctrl+w k | Move to top window |
Ctrl+w l | Move to right window |
Ctrl+w w | Cycle through windows |
Ctrl+w = | Equal size windows |
Ctrl+w _ | Max height current window |
Ctrl+w | | Max width current window |
Ctrl+w c | Close window |
Ctrl+w o | Close all other windows |
Brackets and Matching
| Key | Action |
|---|
% | Jump to matching bracket/paren |
[{ | Jump to previous opening brace |
]} | Jump to next closing brace |
[( | Jump to previous opening paren |
]) | Jump to next closing paren |
Special (Miscellaneous)
| Key | Action |
|---|
r[char] | Replace character under cursor |
R | Replace mode (overwrite) |
q[a-z] | Start recording macro |
@[a-z] | Play macro |
@@ | Replay last macro |
& | Repeat last :substitute |
gv | Reselect last selection |
; | Repeat last f/t/F/T search |
, | Repeat last f/t/F/T search in opposite direction |
f[char] | Find char on line (forward) |
F[char] | Find char on line (backward) |
t[char] | Till char on line (forward) |
T[char] | Till char on line (backward) |
QWERTY Layout with Commands
Esc 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ Bksp
Tab q w e r t y u i o p [{ ]} \|
a s d f g h j k l ;: '"
z x c v b n m ,< .> /?
Most used keys:
- Left side (QWERT/ASDFG/ZXCVB): Motion, search, operators
- Right side (YUIOP/HJKL/NM): Movement, selection, copy/paste
- Modifiers: Ctrl, Shift, Alt for extended commands
Common Command Chains
Edit a word
cw[new word]Esc " Change word
Delete 3 lines
3dd " Delete 3 lines
Copy and paste
yy " Copy line
p " Paste below
Find and replace
/pattern " Find
:%s/old/new/g " Replace all
Undo and redo
u " Undo
Ctrl+r " Redo
Learning Strategy
Start with these 10 keys:
hjkl - Movement
w/b - Word movement
dd - Delete line
yy - Copy line
p - Paste
i - Insert mode
Esc - Normal mode
u - Undo
/ - Search
:wq - Save and quit
Then add:
cw - Change word
v - Visual select
dw - Delete word
o - Insert line
Master these, then explore others as needed.
LazyVim Specific Additions
LazyVim adds custom keybindings (Space = leader):
| Key | Action |
|---|
Space | Open Which Key menu |
Space ff | Find files |
Space fg | Find by grep |
Space e | Toggle file explorer |
gd | Go to definition |
K | Hover documentation |
Space ca | Code actions |
Space / | Toggle terminal |
Ctrl+h/j/k/l | Navigate windows |
See Installing LazyVim for full LazyVim keybindings.
Practice Tips
- Use relative numbers (
set relativenumber) to practice counting motions
- Disable arrow keys to force hjkl usage
- Learn combos: Most power comes from combining operators + motions
- Type slowly: Speed comes naturally; focus on accuracy first
- Use
. repeat to practice the same edit multiple times
- Create marks for positions you jump to frequently
Links
Vim Cheat Sheet
OpenVim - Interactive Vim Tutorial
Vim Adventure Game