Vim Cheat Sheet: The Complete Shortcuts & Commands Reference

Vim is a free, open-source modal text editor where every keyboard shortcut depends on the active mode Normal, Insert, Visual, or Command-line. This cheat sheet covers 100+ Vim shortcuts for cursor movement, editing, copy and paste, search and replace, macros, and more, organized by task so you can find any command fast. Every shortcut is verified for the latest Vim and works in Neovim too.

Whether you’re learning Vim for the first time or just need a quick reference, bookmark this page or download the free PDF to keep it handy. If you’re new to Vim, start with these 15 shortcuts. Master these first and you’ll be able to open, edit, save, and exit files comfortably before moving on to the full command set.

Top 15 Vim Shortcuts for Beginners

#ShortcutWhat it does
1iEnter Insert mode (start typing)
2EscReturn to Normal mode
3:wSave the file
4:qQuit
5:wqSave and quit
6:q!Quit without saving
7h j k lMove left, down, up, right
8xDelete a character
9ddDelete (cut) a line
10yyCopy a line
11pPaste
12uUndo
13Ctrl + rRedo
14/patternSearch for text
15:%s/old/new/gFind and replace

Cursor Movement Shortcuts

ActionShortcut
Move lefth
Move downj
Move upk
Move rightl
Jump to start of next wordw
Jump to start of next word (incl. punctuation)W
Jump to end of worde
Jump to end of word (incl. punctuation)E
Jump back to start of wordb
Jump back to start of word (incl. punctuation)B
Start of line0
First non-blank character of line^
End of line$
Last non-blank character of lineg_
Jump to matching bracket () {} []%
Go to first line of filegg
Go to last line of fileG
Go to line number 55G
Jump to next occurrence of character xfx
Jump to before next occurrence of xtx
Next paragraph / code block}
Previous paragraph / code block{
Center cursor on screenzz
Move screen down half a pageCtrl + d
Move screen up half a pageCtrl + u
Move screen down one full pageCtrl + f
Move screen up one full pageCtrl + b

Insert Mode Shortcuts

ActionShortcut
Insert before the cursori
Insert at the beginning of the lineI
Append after the cursora
Append at the end of the lineA
Open a new line belowo
Open a new line aboveO
Append at the end of the wordea
Delete word before cursor (insert mode)Ctrl + w
Insert contents of register xCtrl + r x
Exit insert modeEsc or Ctrl + c

Editing Shortcuts

ActionShortcut
Replace a single characterr
Replace many characters until EscR
Join line below to current (one space)J
Join line below without spacegJ
Change entire linecc
Change to end of linec$ or C
Change entire wordciw
Change to end of wordcw
Delete character and substitute texts
Delete line and substitute textS
Switch case up to motiong~
Make text uppercase up to motiongU
Make text lowercase up to motiongu
Transpose two lettersxp
Undou
RedoCtrl + r
Repeat the last command.

Cut & Paste Shortcuts

ActionShortcut
Yank (copy) a lineyy
Yank 2 lines2yy
Yank a wordyw
Yank word under the cursoryiw
Yank to end of liney$ or Y
Paste after the cursorp
Paste before the cursorP
Delete (cut) a linedd
Delete (cut) 2 lines2dd
Delete (cut) a worddw
Delete (cut) to end of lined$ or D
Delete (cut) a single characterx
Delete lines 3 to 5:3,5d

Visual Mode Shortcuts

ActionShortcut
Start visual mode (character-wise)v
Start linewise visual modeV
Start visual block modeCtrl + v
Move to other end of marked areao
Move to other corner of blockO
Mark a wordaw
A () blockab
A {} blockaB
A <> tag blockat
Inner () blockib
Inner {} blockiB
Exit visual modeEsc

Visual Commands Shortcuts

ActionShortcut
Shift text right>
Shift text left<
Yank (copy) marked texty
Delete marked textd
Switch case~
Make marked text lowercaseu
Make marked text uppercaseU

Search & Replace Shortcuts

ActionShortcut
Search forward for pattern/pattern
Search backward for pattern?pattern
Repeat search, same directionn
Repeat search, opposite directionN
Replace all old with new in file:%s/old/new/g
Replace all, with confirmation:%s/old/new/gc
Remove search highlighting:noh
Search pattern across multiple files:vimgrep /pattern/ **/*

Registers & Marks Shortcuts

ActionShortcut
Show register contents:reg
Yank into register x“xy
Paste contents of register x“xp
Yank into system clipboard“+y
Paste from system clipboard“+p
List all marks:marks
Set mark a at current positionma
Jump to mark a`a
Jump to position before last jump
Jump to position of last change`.

Macros in Vim

ActionShortcut
Start recording macro into register aqa
Stop recordingq
Play macro a@a
Replay last-run macro@@
Run macro a 5 times5@a

How to record a macro (step-by-step): Press qa to start recording into register a → perform your sequence of edits → press q to stop → press @a to replay it, or 5@a to repeat it five times. Macros are how Vim users automate repetitive edits across many lines.

Working with Files, Windows & Buffers Shortcuts

ActionShortcut
Edit a file in a new buffer:e filename
Go to next buffer:bnext
Go to previous buffer:bprev
Delete (close) a buffer:bd
List all open buffers:ls
Split window horizontallyCtrl + ws
Split window verticallyCtrl + wv
Switch between windowsCtrl + ww
Quit a windowCtrl + wq
Make all windows equal sizeCtrl + w=
Open a file in a new tab:tabnew
Move to next tabgt
Move to previous tabgT
Close current tab:tabclose

Folding Shortcuts

ActionShortcut
Toggle fold under cursorza
Open fold under cursorzo
Close fold under cursorzc
Open all folds one levelzr
Close all folds one levelzm

Exit Shortcuts

ActionShortcut
Write (save), don’t exit:w
Write (save) and quit:wq or 😡 or ZZ
Quit (fails if unsaved changes):q
Quit, discard all changes:q! or ZQ
Save and quit all tabs:wqa

Vim Modes Explained

Vim is a modal editor, which means the same key does different things depending on which mode you’re in. This is the concept that confuses every beginner pressing j moves your cursor down in one mode but types the letter “j” in another. Once modes click, the rest of Vim follows naturally.

Vim has four modes you’ll use daily:

Normal Mode

This is where Vim starts, and where you’ll spend most of your time. In Normal mode, keys are commands, not text dd deletes a line, yy copies one, j and k move the cursor. Think of Normal mode as the “navigation and editing” home base. Press Esc to return to Normal mode from anywhere.

Insert Mode

This is the mode that behaves like a regular text editor what you type appears on screen. You enter Insert mode with commands like i (insert before cursor), a (append after cursor), or o (open a new line below). Press Esc to leave Insert mode and return to Normal mode.

Visual Mode

Visual mode is for selecting text before acting on it. Press v for character-wise selection, V for line-wise, or Ctrl + v for block selection. Once text is highlighted, an operator like d (delete) or y (yank/copy) acts on the whole selection.

Command-Line Mode

Entered by typing : from Normal mode, this is where you run commands like :w (save), :q (quit), and :%s/old/new/g (search and replace). It’s also how you access search with / and ?.

Here’s how the modes connect:

From → ToKey
Any mode → NormalEsc
Normal → Inserti, a, o, I, A, O
Normal → Visualv, V, Ctrl + v
Normal → Command-line:
Normal → Search/, ?

Key insight: When you’re lost in Vim, press Esc twice. This guarantees you’re in Normal mode, the safe starting point for any command.

How Vim Commands Work: Operator + Motion

The reason Vim feels powerful once it clicks is that its commands work like a language. Instead of memorizing hundreds of separate shortcuts, you learn a small set of building blocks and combine them. Most Vim commands follow this pattern:

[count] + operator + motion

An operator is the action delete, change, yank (copy). A motion is what the action applies to a word, a line, to the end of the line. You combine them like a verb and an object.

Take the delete operator d:

CommandOperatorMotionResult
dwd (delete)w (word)Delete to the start of the next word
d$d (delete)$ (end of line)Delete to the end of the line
ddd (delete)d (whole line)Delete the entire line
2dwd (delete)w × 2Delete two words

The same logic applies to other operators. Swap d for c (change) and you get cw (change a word) or c$ (change to end of line). Swap it for y (yank) and you get yw (copy a word) or y$ (copy to end of line).

This is why you don’t need to memorize every shortcut in this cheat sheet separately. Learn the operators (d, c, y), learn the motions (w, b, e, $, 0, G), and you can mix them into hundreds of precise edits.

Think of it as a sentence: d (delete) + w (word) = dw, “delete word.” Once you read commands this way, Vim stops being a list of keys and becomes a grammar you compose.

The [count] prefix multiplies any command. 3j moves down three lines, 2dd deletes two lines, 5yy copies five. Put a number before almost any command and Vim repeats it that many times.

Vim Shortcuts FAQ

How do I exit Vim?

To exit Vim, first press Esc to make sure you’re in Normal mode, then type :q and press Enter to quit. If you’ve made changes you want to keep, use :wq to save and quit. To quit without saving, use :q!.

How do I save and quit in Vim?

Press Esc, then type :wq and press Enter. This writes (saves) the file and quits in one step. You can also use :x, which saves and quits but only writes the file if there were changes.

How do I copy and paste in Vim?

In Normal mode, position your cursor and press yy to copy (yank) a line, then move to the destination and press p to paste after the cursor or P to paste before it. To copy a single word, use yw.

How do I undo and redo in Vim?

Press u in Normal mode to undo the last change. To redo, press Ctrl + r. You can undo multiple times by pressing u repeatedly.

Are Vim shortcuts the same on Mac?

Yes, the core Vim shortcuts are identical on macOS, Linux, and Windows because they’re built into Vim itself, not the operating system. The main difference is that some Mac keyboards require remapping if you want to hold a navigation key (like j) to repeat it.

Are Vim and Neovim shortcuts the same?

Almost entirely, yes. Neovim is a fork of Vim and keeps full compatibility with Vim’s default keybindings, so every shortcut in this cheat sheet works in both. Neovim adds extra features and plugin options, but the core commands are unchanged.

Is Vim hard to learn?

Vim has a steep initial learning curve because it’s a modal editor keys behave differently depending on the mode. But once you understand modes and the operator-plus-motion grammar, the commands become intuitive. Most users feel comfortable with the basics within a week of regular use. Running vimtutor in your terminal is the fastest way to start.

How do I install Vim?

Vim comes pre-installed on most Linux and macOS systems. To install or update it, use your package manager: sudo apt install vim on Debian/Ubuntu, brew install vim on macOS, or download the installer from vim.org on Windows.

Conclusion

Vim rewards the time you invest in it. The learning curve is real but once modes and the operator-plus-motion grammar click, you stop reaching for the mouse entirely and edit at the speed of thought. You don’t need to memorize all 100+ shortcuts on this page. Start with the 15 beginner shortcuts above, keep this cheat sheet open in a tab, and add a few new commands each week. Within a month, the muscle memory takes over.

Every shortcut here works in both Vim and Neovim, and on Linux, macOS, and Windows alike. The fastest way to build fluency is to run vimtutor in your terminal it’s a free, interactive lesson built into Vim itself and then practice on real files.

READ NEXT:

Pratik

Pratik is the founder of Tutorial Tactic and a productivity tools specialist with 15 years of hands-on experience in Google Workspace, Microsoft Office, and software automation. He has published over 1,500 guides on keyboard shortcuts, software commands, how-to tutorials and workflow optimization, helping readers across the US and India work faster with the tools they use every day. Tutorial Tactic was founded in 2021 with one goal: cut through the noise and give readers exactly what they need fast, verified, and beginner-friendly.
Back to top button