Updated May 2026 · 10 min read

Vim Cheat Sheet: Complete Keyboard Shortcuts Reference

Vim is the editor that developers either never touch again after their first accidental opening, or never stop using after they learn it. The modal editing system is unusual, but once internalized it makes editing text faster than any other editor. This cheat sheet covers every mode and every essential shortcut in one reference.

For the full interactive reference, see the Vim shortcuts cheat sheet.

Understanding Vim's Modes

The single most important thing to understand about Vim is that it operates in different modes. Each mode serves a distinct purpose:

ModePurposeHow to Enter
NormalNavigate, delete, copy, paste, run commandsPress Esc from any mode
InsertType texti, a, o, O, I, A
VisualSelect text for operationsv (char), V (line), Ctrl+V (block)
CommandRun ex commands (save, quit, search): from Normal mode
SearchSearch forward or backward/ or ? from Normal mode

Exiting Vim (The Basics)

CommandAction
:qQuit (fails if unsaved changes)
:q!Force quit — discard all changes
:wSave (write) without quitting
:wq or :xSave and quit
ZZSave and quit (Normal mode shorthand for :wq)
ZQQuit without saving (Normal mode shorthand for :q!)

Normal Mode Navigation

In Vim, you navigate without arrow keys. These motions are the foundation of all Vim editing.

KeyAction
h j k lLeft, Down, Up, Right
wNext word (start)
bPrevious word (start)
eEnd of current/next word
0Start of line
^First non-blank character of line
$End of line
ggFirst line of file
GLast line of file
:42Go to line 42
Ctrl+FScroll page down
Ctrl+BScroll page up
Ctrl+DScroll half page down
Ctrl+UScroll half page up
%Jump to matching bracket/paren/brace
f{char}Jump forward to character on line
F{char}Jump backward to character on line
Ctrl+OJump back in jump list
Ctrl+IJump forward in jump list

Entering Insert Mode

KeyAction
iInsert before cursor
aAppend after cursor
IInsert at start of line
AAppend at end of line
oOpen new line below, enter Insert
OOpen new line above, enter Insert
sDelete character and enter Insert
SDelete line and enter Insert
c{motion}Change (delete + enter Insert)
ccChange entire line
CChange from cursor to end of line

Editing in Normal Mode

KeyAction
xDelete character under cursor
XDelete character before cursor
ddDelete (cut) entire line
d{motion}Delete with motion (e.g. dw, d$, d^)
DDelete from cursor to end of line
yyYank (copy) entire line
y{motion}Yank with motion
pPaste after cursor / below line
PPaste before cursor / above line
uUndo
Ctrl+RRedo
.Repeat last change (extremely powerful)
r{char}Replace single character
~Toggle case of character under cursor
JJoin current line with next line
>>Indent line
<<Outdent line

Search & Replace

CommandAction
/patternSearch forward for pattern
?patternSearch backward for pattern
nNext search match
NPrevious search match
*Search for word under cursor (forward)
#Search for word under cursor (backward)
:s/old/new/gReplace all in current line
:%s/old/new/gReplace all in file
:%s/old/new/gcReplace all with confirmation
:nohClear search highlight

Visual Mode Selection

KeyAction
vEnter character-wise Visual mode
VEnter line-wise Visual mode
Ctrl+VEnter block (column) Visual mode
oMove to other end of selection
d or xDelete selection
yYank (copy) selection
> / <Indent / outdent selection
~Toggle case of selection
u / ULowercase / uppercase selection

Text Objects (The Most Powerful Vim Feature)

Text objects let you operate on semantically meaningful units. The pattern is operator + i/a + object (e.g. ciw = change inner word).

CommandAction
ciwChange inner word (replace word, stay in Insert)
diwDelete inner word
yiwYank inner word
ci"Change inside double quotes
ci(Change inside parentheses
da[Delete a bracket pair and contents
vipSelect entire paragraph
dapDelete entire paragraph

Working with Multiple Files

CommandAction
:e filenameOpen a file
:spHorizontal split
:vspVertical split
Ctrl+W Ctrl+WCycle between splits
Ctrl+W h/j/k/lMove between splits directionally
:tabnewOpen new tab
gt / gTNext / previous tab
:lsList open buffers
:b{N}Switch to buffer N

Pro Tips for Vim Beginners

  • The . (dot) command is Vim's superpower — repeat your last change with a single key. Learn to think in composable operations (delete word → dot dot dot) rather than making one-off edits.
  • Use ci" and ci( constantly — change inside quotes/parentheses without needing to manually select. These two text objects alone will make you significantly faster with code.
  • Learn hjkl before anything else — resist using arrow keys. Once hjkl is muscle memory, navigation becomes natural and you'll stop leaving home row.
  • :set number and :set relativenumber — relative line numbers let you instantly see "I need to jump 7 lines down" and type 7j. This makes the number motions (5dd, 3yy) practical.
  • Start with Neovim or VS Code Vim plugin — you get Vim keybindings with modern tooling (LSP, auto-complete, file explorer) rather than learning to configure a bare Vim from scratch.

Download the Developer Shortcuts PDF

The Developer Pack PDF includes complete cheat sheets for Vim, VS Code, IntelliJ IDEA, Cursor, and Chrome — formatted for printing or keeping on your desk.

Related Shortcut References

Frequently Asked Questions

How do I exit Vim?

Press Esc to make sure you are in Normal mode, then type :q and press Enter to quit if there are no unsaved changes. To save and quit, type :wq (write and quit) or :x. To quit without saving, type :q! to force-quit. This is the single most-searched question in Vim's history.

What are the three modes in Vim?

Vim has three primary modes: Normal mode (where you navigate, delete, copy, and run commands — you start here), Insert mode (where you type text, entered with i, a, o, or similar keys), and Visual mode (for selecting text, entered with v, V, or Ctrl+V). Press Esc from any mode to return to Normal mode.

How do I search for text in Vim?

In Normal mode, press / followed by your search term and Enter to search forward through the file. Press ? to search backward. Press n to jump to the next match and N to go to the previous match. Press * to instantly search for the word under the cursor.

How do I undo and redo in Vim?

Press u in Normal mode to undo the last change. Press Ctrl+R to redo (re-apply what was undone). Vim maintains a complete, branching undo history — you can undo an arbitrarily large number of changes, and Vim stores the entire history even across sessions if undofile is enabled.

What is the difference between i, a, o, and O in Vim?

All four enter Insert mode but from different positions: i inserts before the cursor, a inserts after the cursor (append), o opens a new line below the current line, and O opens a new line above the current line. Using the right one eliminates the need to manually reposition the cursor before typing.