Vim Editor Cheat Sheet
A searchable reference of essential Vim commands and what each keystroke does.
| Keys | What it does |
|---|---|
i | Enter insert mode before the cursor. |
a | Enter insert mode after the cursor. |
A | Enter insert mode at the end of the current line. |
o | Open a new line below the current one and enter insert mode. |
O | Open a new line above the current one and enter insert mode. |
Esc | Leave insert or visual mode and return to normal mode. |
v | Start charwise visual mode to select text one character at a time. |
V | Start linewise visual mode to select whole lines. |
Ctrl-v | Start blockwise visual mode to select a rectangular block. |
R | Enter replace mode, which overtypes existing characters as you type. |
h j k l | Move the cursor left, down, up, and right. |
w b e | Jump to the start of the next word, the start of the previous word, or the end of the current word. |
0 ^ $ | Go to the first column, the first non-blank character, or the end of the line. |
gg / G | Jump to the first or the last line of the file. |
{n}G | Jump to line number n, for example 20G goes to line 20. |
Ctrl-d / Ctrl-u | Scroll down or up by half a screen. |
% | Jump to the matching bracket, paren, or brace. |
H M L | Move to the top, middle, or bottom of the visible screen. |
{ } | Jump to the previous or next blank-line paragraph. |
x | Delete the single character under the cursor. |
dd / dw / d$ | Delete the whole line, delete to the start of the next word, or delete to the end of the line. |
yy / yw | Yank (copy) the whole line, or yank from the cursor to the start of the next word. |
p / P | Paste the last yank or delete after or before the cursor. |
u | Undo the last change. |
Ctrl-r | Redo a change that was just undone. |
cc / cw | Change the whole line, or change to the end of the word, then enter insert mode. |
r / s | Replace the character under the cursor with the next key (r), or delete it and enter insert mode (s). |
J | Join the next line onto the end of the current line. |
. | Repeat the last change. |
>> / << | Indent the current line to the right or left by one shiftwidth. |
/pattern | Search forward for a pattern starting from the cursor. |
?pattern | Search backward for a pattern starting from the cursor. |
n | Repeat the last search in the same direction. |
N | Repeat the last search in the opposite direction. |
* | Search forward for the whole word under the cursor. |
# | Search backward for the whole word under the cursor. |
:s/old/new/ | Replace the first match of old with new on the current line. |
:%s/old/new/g | Replace every match of old with new in the whole file. |
:%s/old/new/gc | Replace every match in the file, asking you to confirm each one. |
:w | Write (save) the current file. |
:q | Quit the current window if there are no unsaved changes. |
:wq | Write the file and then quit. |
:x | Write the file only if it changed, then quit. |
:q! | Quit and throw away any unsaved changes. |
:w! | Force-write the file even when it is marked read-only. |
:e file | Open another file for editing in the current window. |
:saveas | Save the current buffer under a new file name. |
ZZ / ZQ | Save and quit (ZZ), or quit without saving (ZQ), as normal-mode shortcuts. |
v | Select text one character at a time. |
V | Select whole lines at a time. |
Ctrl-v | Select a rectangular block of text. |
y | Yank (copy) the current selection. |
d | Delete (cut) the current selection. |
c | Delete the selection and enter insert mode. |
> / < | Indent the selected lines to the right or to the left. |
gv | Reselect the last visual selection. |
o | Move the cursor to the other end of the current selection. |
:sp / :vsp | Split the window horizontally (:sp) or vertically (:vsp) into two panes. |
Ctrl-w w | Cycle focus to the next window. |
Ctrl-w h/j/k/l | Move focus to the window on the left, below, above, or right. |
:tabnew | Open a new tab page. |
gt | Go to the next tab page. |
ma | Set mark a at the current cursor position. |
`a | Jump back to mark a (backtick then the letter a). |
No shortcuts match your search.
Runs entirely in your browser. Nothing you type is sent anywhere; open DevTools and watch the Network tab to verify zero requests.
What this tool does
This is a searchable quick reference for the Vim keystrokes you reach for every day, from switching modes and moving the cursor to editing text, searching, saving files, and juggling splits. Each row pairs the exact keys with a plain-English note on what they do. Type in the filter box to search across both columns, or tap a category button to focus on one kind of task. The whole list is built into the page, so it works offline and sends nothing anywhere.
How to use it
Start typing in the Filter box. Entering quit surfaces
the ways to leave Vim; entering delete shows the cut and change commands;
entering search jumps to the find and substitute keystrokes. The
category buttons (Modes, Movement, Editing, Search and replace, Files,
Visual, Windows) narrow the table to one family and combine with the text filter, so
you can pick Editing and type line to see only the line-level commands.
Clear the box to see the full sheet again.
Common use cases
- Remembering how to save and quit when you are stuck in Vim for the first time.
- Looking up the exact substitute syntax, such as
:%s/old/new/g, before a big find and replace. - Learning the motion keys (
w,b,gg,G) so you can stop reaching for the arrow keys. - Copying the right visual-mode operator to yank, delete, or reindent a selection.
- Refreshing the split and tab commands when you work across several files at once.
Common pitfalls
- Getting stuck in insert mode. Many colon commands and motion keys
only work in normal mode. If your keystrokes are typing letters into the file instead
of running commands, press
Escto return to normal mode first. - Quitting without saving versus forcing a quit. Plain
:qrefuses to close when there are unsaved changes. Use:wqto save and quit, or:q!to deliberately throw the changes away. Reach for:q!only when you truly want to discard your edits. - Caps Lock changing your commands. Vim is case sensitive, so a stray
Caps Lock turns
iintoI,aintoA, anduintoU, all of which do different things. If commands behave oddly, check that Caps Lock is off. - Confusing colon commands with normal-mode keys. Commands that begin
with a colon, like
:wor:s, are typed on the command line and need Enter to run. Normal-mode keys, likeddorx, act the instant you press them. Mixing the two up is a frequent source of confusion.
Frequently asked questions
- How do I quit Vim?
- Press Esc first to make sure you are in normal mode, then type :q and press Enter to quit. If Vim refuses because you have unsaved changes, either save first with :w or discard the changes and force the quit with :q! followed by Enter.
- How do I save and quit in Vim?
- From normal mode, type :wq and press Enter to write the file and quit in one step. The command :x does almost the same thing but only writes when the file actually changed. The normal-mode shortcut ZZ (two capital Z keys) also saves and quits without a colon.
- What is the difference between i and a in Vim?
- Both keys start insert mode, but they differ by one position. The i command starts typing before the character under the cursor, while a starts typing just after it. Use A to jump straight to the end of the line, and o to open a fresh line below the cursor.
- How do I search and replace all matches in Vim?
- Use :%s/old/new/g and press Enter to replace every occurrence of old with new across the whole file. Add a c flag, as in :%s/old/new/gc, to confirm each replacement one at a time. Drop the % to limit the change to only the current line.
- What is visual mode in Vim?
- Visual mode lets you select a range of text and then act on it. Press v for a character selection, V for whole lines, or Ctrl-v for a rectangular block, move to extend the highlight, then press an operator such as y to copy, d to delete, or c to change. Press Esc to leave the selection without acting on it.
- How do I undo and redo in Vim?
- Press u in normal mode to undo the last change, and keep pressing it to walk further back through your edit history. Press Ctrl-r to redo a change you just undid. Vim keeps a full undo history, so you can recover work even after several steps.
- Does this cheat sheet send my searches anywhere?
- No. The whole command list is baked into the page and every filter runs locally in your browser with JavaScript, so nothing you type is sent to any server. This tool is fully client-side; open your browser DevTools and watch the Network tab to confirm there are zero requests.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.