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:
| Mode | Purpose | How to Enter |
|---|---|---|
| Normal | Navigate, delete, copy, paste, run commands | Press Esc from any mode |
| Insert | Type text | i, a, o, O, I, A |
| Visual | Select text for operations | v (char), V (line), Ctrl+V (block) |
| Command | Run ex commands (save, quit, search) | : from Normal mode |
| Search | Search forward or backward | / or ? from Normal mode |
Exiting Vim (The Basics)
| Command | Action |
|---|---|
:q | Quit (fails if unsaved changes) |
:q! | Force quit — discard all changes |
:w | Save (write) without quitting |
:wq or :x | Save and quit |
ZZ | Save and quit (Normal mode shorthand for :wq) |
ZQ | Quit 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.
| Key | Action |
|---|---|
h j k l | Left, Down, Up, Right |
w | Next word (start) |
b | Previous word (start) |
e | End of current/next word |
0 | Start of line |
^ | First non-blank character of line |
$ | End of line |
gg | First line of file |
G | Last line of file |
:42 | Go to line 42 |
Ctrl+F | Scroll page down |
Ctrl+B | Scroll page up |
Ctrl+D | Scroll half page down |
Ctrl+U | Scroll 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+O | Jump back in jump list |
Ctrl+I | Jump forward in jump list |
Entering Insert Mode
| Key | Action |
|---|---|
i | Insert before cursor |
a | Append after cursor |
I | Insert at start of line |
A | Append at end of line |
o | Open new line below, enter Insert |
O | Open new line above, enter Insert |
s | Delete character and enter Insert |
S | Delete line and enter Insert |
c{motion} | Change (delete + enter Insert) |
cc | Change entire line |
C | Change from cursor to end of line |
Editing in Normal Mode
| Key | Action |
|---|---|
x | Delete character under cursor |
X | Delete character before cursor |
dd | Delete (cut) entire line |
d{motion} | Delete with motion (e.g. dw, d$, d^) |
D | Delete from cursor to end of line |
yy | Yank (copy) entire line |
y{motion} | Yank with motion |
p | Paste after cursor / below line |
P | Paste before cursor / above line |
u | Undo |
Ctrl+R | Redo |
. | Repeat last change (extremely powerful) |
r{char} | Replace single character |
~ | Toggle case of character under cursor |
J | Join current line with next line |
>> | Indent line |
<< | Outdent line |
Search & Replace
| Command | Action |
|---|---|
/pattern | Search forward for pattern |
?pattern | Search backward for pattern |
n | Next search match |
N | Previous search match |
* | Search for word under cursor (forward) |
# | Search for word under cursor (backward) |
:s/old/new/g | Replace all in current line |
:%s/old/new/g | Replace all in file |
:%s/old/new/gc | Replace all with confirmation |
:noh | Clear search highlight |
Visual Mode Selection
| Key | Action |
|---|---|
v | Enter character-wise Visual mode |
V | Enter line-wise Visual mode |
Ctrl+V | Enter block (column) Visual mode |
o | Move to other end of selection |
d or x | Delete selection |
y | Yank (copy) selection |
> / < | Indent / outdent selection |
~ | Toggle case of selection |
u / U | Lowercase / 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).
| Command | Action |
|---|---|
ciw | Change inner word (replace word, stay in Insert) |
diw | Delete inner word |
yiw | Yank inner word |
ci" | Change inside double quotes |
ci( | Change inside parentheses |
da[ | Delete a bracket pair and contents |
vip | Select entire paragraph |
dap | Delete entire paragraph |
Working with Multiple Files
| Command | Action |
|---|---|
:e filename | Open a file |
:sp | Horizontal split |
:vsp | Vertical split |
Ctrl+W Ctrl+W | Cycle between splits |
Ctrl+W h/j/k/l | Move between splits directionally |
:tabnew | Open new tab |
gt / gT | Next / previous tab |
:ls | List 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
- Vim Shortcuts — Full Interactive Reference
- VS Code Keyboard Shortcuts
- VS Code vs Vim Shortcuts Compared
- IntelliJ IDEA Keyboard Shortcuts
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.