Back to articles

Vim Keyboard Reference

Computer TechDevelopmentEditorsVim Keyboard Reference
Updated 4/23/2026

Vim Keyboard Reference

Complete QWERTY keyboard reference for Vim commands in Normal mode. This covers movement, editing, searching, and common operations.

Essential Modes

KeyAction
EscEnter Normal mode (from Insert/Visual)
iInsert mode (cursor before character)
aInsert mode (cursor after character)
IInsert at start of line
AInsert at end of line
oInsert new line below
OInsert new line above
vVisual mode (character select)
VVisual mode (line select)
Ctrl+vVisual mode (block select)
:Command mode
/Search forward
?Search backward

Movement - Home Row (HJKL)

        ↑
        k
    ← h   l →
        j
        ↓
KeyAction
hMove left 1 character
jMove down 1 line
kMove up 1 line
lMove right 1 character
0Move 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)

KeyAction
wJump to start of next word
bJump to start of previous word
eJump to end of word
WJump to start of next WORD (ignores punctuation)
BJump to start of previous WORD
EJump to end of WORD
geJump to end of previous word
gEJump to end of previous WORD

Line Movement (Left Side)

KeyAction
ggJump to start of file
GJump to end of file
[line]GJump to specific line (e.g., 69G)
Ctrl+gShow current line number
)Jump to next sentence
(Jump to previous sentence
}Jump to next paragraph
{Jump to previous paragraph

Scrolling

KeyAction
Ctrl+fScroll forward (page down)
Ctrl+bScroll backward (page up)
Ctrl+dScroll down (half page)
Ctrl+uScroll up (half page)
Ctrl+eScroll down 1 line
Ctrl+yScroll up 1 line
ztCenter cursor at top of screen
zzCenter cursor in middle of screen
zbCenter cursor at bottom of screen

Deletion (D-Row)

KeyAction
xDelete character under cursor
XDelete character before cursor
dwDelete to end of word
dbDelete to start of word
ddDelete entire line
d0Delete to start of line
d$Delete to end of line
dGDelete to end of file
dggDelete to start of file
d[n]jDelete n lines down (e.g., d3j deletes 3 lines)
DDelete to end of line (same as d$)

Change (C-Row - Insert After Delete)

KeyAction
cwChange word (delete + insert mode)
cbChange to start of word
ccChange entire line
c0Change to start of line
c$Change to end of line
CChange to end of line (same as c$)
sSubstitute character (delete + insert mode)
SSubstitute entire line (same as cc)

Copy/Paste (Y-Row and P-Row)

KeyAction
yyCopy entire line
ywCopy to end of word
ybCopy to start of word
y0Copy to start of line
y$Copy to end of line
yGCopy to end of file
yggCopy to start of file
pPaste after cursor
PPaste before cursor
]pPaste with auto-indent
[pPaste before with auto-indent

Undo/Redo (U-Row)

KeyAction
uUndo last change
UUndo all changes on line
Ctrl+rRedo
g-Go to older text state
g+Go to newer text state

Find/Replace (F and R)

KeyAction
/patternSearch forward
?patternSearch backward
nNext search result
NPrevious 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/gReplace all on current line
:%s/old/new/gReplace all in file
:%s/old/new/gcReplace all with confirmation

Selection - Visual Mode (V)

KeyAction
vStart visual selection (characters)
VStart visual selection (lines)
Ctrl+vStart visual selection (block)
oJump to other end of selection
awSelect word (in visual or operator)
abSelect block with brackets
atSelect tag block (HTML/XML)
iwSelect inside word
ibSelect inside brackets
itSelect inside tags

Operators (Can Be Combined with Motions)

Pattern: [operator][motion]

OperatorAction
dDelete
cChange (delete + insert)
yYank (copy)
>Indent right
<Indent left
=Autoindent
gUUppercase
guLowercase
~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

KeyAction
.Repeat last command
[n]Prefix any command with number (e.g., 5j = down 5 lines)
[n]ddDelete n lines
[n]yyCopy n lines
[n]pPaste n times
[n].Repeat last command n times

Marks and Jumps (M and G)

KeyAction
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+oJump to previous position (older)
Ctrl+iJump to next position (newer)
g;Jump to previous change
g,Jump to next change

Increment/Decrement (Numbers)

KeyAction
Ctrl+aIncrement number under cursor
Ctrl+xDecrement number under cursor

Case Operations (G-Row)

KeyAction
~Toggle case of character
g~wToggle case of word
gUwUppercase word
guwLowercase word
gUUUppercase line
guuLowercase line

Line Operations (Blank Row)

KeyAction
JJoin lines (delete newline)
gJJoin lines (no space)
[count]JJoin n lines (e.g., 3J joins 3 lines)

Indentation (Q-Row, Z-Row)

KeyAction
>>Indent line right
<<Indent line left
==Autoindent line
>[motion]Indent selection
<[motion]Unindent selection
=[motion]Autoindent selection
TabInsert tab (in insert mode)
Shift+TabDelete tab (in insert mode)

Folding (Z-Row)

KeyAction
zf[motion]Create fold
zoOpen fold
zcClose fold
zaToggle fold
zROpen all folds
zMClose all folds

Command Mode (Colon)

CommandAction
:wSave file
:qQuit
:wqSave and quit
:q!Quit without saving
:e [file]Open file
:bnNext buffer
:bpPrevious buffer
:bdDelete buffer
:vs [file]Open file in vertical split
:sp [file]Open file in horizontal split
:set numberShow line numbers
:set relativenumberShow relative line numbers
:set spellEnable spell checking
:help [topic]Open help

Window Navigation (Ctrl+W)

KeyAction
Ctrl+w hMove to left window
Ctrl+w jMove to bottom window
Ctrl+w kMove to top window
Ctrl+w lMove to right window
Ctrl+w wCycle through windows
Ctrl+w =Equal size windows
Ctrl+w _Max height current window
Ctrl+w |Max width current window
Ctrl+w cClose window
Ctrl+w oClose all other windows

Brackets and Matching

KeyAction
%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)

KeyAction
r[char]Replace character under cursor
RReplace mode (overwrite)
q[a-z]Start recording macro
@[a-z]Play macro
@@Replay last macro
&Repeat last :substitute
gvReselect 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:

  1. hjkl - Movement
  2. w/b - Word movement
  3. dd - Delete line
  4. yy - Copy line
  5. p - Paste
  6. i - Insert mode
  7. Esc - Normal mode
  8. u - Undo
  9. / - Search
  10. :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):

KeyAction
SpaceOpen Which Key menu
Space ffFind files
Space fgFind by grep
Space eToggle file explorer
gdGo to definition
KHover documentation
Space caCode actions
Space /Toggle terminal
Ctrl+h/j/k/lNavigate windows

See Installing LazyVim for full LazyVim keybindings.

Practice Tips

  1. Use relative numbers (set relativenumber) to practice counting motions
  2. Disable arrow keys to force hjkl usage
  3. Learn combos: Most power comes from combining operators + motions
  4. Type slowly: Speed comes naturally; focus on accuracy first
  5. Use . repeat to practice the same edit multiple times
  6. Create marks for positions you jump to frequently

Vim Cheat Sheet

OpenVim - Interactive Vim Tutorial

Vim Adventure Game