Vim Cheat Sheet
A simple, searchable quick reference for the most-used Vim commands. Click any command to copy it.
Global
- Open help for a keyword
- Open help for a command
- Open a file for editing
- Save (write) the file
- Save all open files
- Quit (fails if unsaved changes)
- Quit and discard changes
- Save and quit
- Quit all open files
Cursor Movement
- Move cursor left
- Move cursor down
- Move cursor up
- Move cursor right
- Jump to start of next word
- Jump to start of previous word
- Jump to end of word
- Jump to start of line
- Jump to first non-blank character
- Jump to end of line
- Go to the first line of the file
- Go to the last line of the file
- Go to line {number}
- Move down half a screen
- Move up half a screen
- Jump to next paragraph
- Jump to previous paragraph
- Jump to matching ( ) [ ] { }
Insert Mode
- Insert before the cursor
- Insert at the start of the line
- Append after the cursor
- Append at the end of the line
- Open a new line below
- Open a new line above
- Append at end of the word
- Exit insert mode
- Run one command, then back to insert
Editing
- Replace a single character
- Delete character under cursor
- Delete (cut) the whole line
- Yank (copy) the whole line
- Paste after the cursor
- Paste before the cursor
- Change (replace) the whole line
- Change to the end of the word
- Change to the end of the line
- Join line below to current line
- Undo
- Redo
- Repeat the last command
- Indent line right
- Indent line left
Operators & Text Objects
- Delete inner word
- Change inner word
- Delete text inside quotes
- Change text inside parentheses
- Delete a paragraph
- Delete up to (but not incl.) comma
- Delete to end of line
- Yank to end of line
- Delete two lines
- Yank three lines
Visual Mode
- Start visual mode (character)
- Start linewise visual mode
- Start block visual mode
- Move to other end of selection
- Yank (copy) the selection
- Delete the selection
- Indent selection right
- Indent selection left
- Lowercase the selection
- Uppercase the selection
Search & Replace
- Search forward for pattern
- Search backward for pattern
- Repeat search in same direction
- Repeat search in opposite direction
- Search for word under cursor
- Replace all old with new in file
- Replace all, with confirmation
- Clear search highlight
Tabs & Windows
- Split window, open file
- Vertical split, open file
- Switch between windows
- Move to window left/down/up/right
- Close the current window
- Open file in a new tab
- Move to the next tab
- Move to the previous tab
Marks & Macros
- Set mark 'a' at current position
- Jump to mark 'a'
- Record macro into register 'a'
- Stop recording the macro
- Run macro 'a'
- Run the last macro again
The Free Vim Cheat Sheet for Developers
Vim is one of the most powerful text editors ever made, but its learning curve comes from the sheer number of keystrokes you can chain together. This cheat sheet collects the commands you reach for every day — cursor movement, inserting and editing text, visual selections, search and replace, working with windows and tabs, and recording macros — into one searchable page. Type a keyword like “delete”, “yank” or “:w” in the search box to instantly filter the list, then click any command to copy it.
Understanding Vim Modes
The single most important concept in Vim is that it is modal. The same key does different things depending on which mode you are in. Master these four modes and the rest of the cheat sheet falls into place.
Normal mode
The default. Keys move the cursor and run commands. Press Esc to return here from any other mode.
Insert mode
Where you actually type text. Enter it with i, a or o. Press Esc to leave.
Visual mode
Select text to operate on. Use v for characters, V for whole lines, and Ctrl+v for a block.
Command-line mode
Run ex commands like :w (save), :q (quit) and :%s (search & replace) after pressing ':'.
The 10 Vim Commands Worth Memorizing First
| Command | What it does |
|---|---|
| i | Start typing (insert before cursor) |
| Esc | Stop typing and return to normal mode |
| :w | Save the file |
| :q / :q! | Quit / quit without saving |
| dd | Delete (cut) the current line |
| yy | Copy the current line |
| p | Paste |
| u | Undo |
| /text | Search for text |
| :%s/a/b/g | Replace every 'a' with 'b' |
Tips for Learning Vim Faster
- Run vimtutor in your terminal — it's a free, built-in 30-minute interactive tutorial.
- Think in verbs and motions: d (delete) + w (word) = delete a word. The same verbs work with any motion.
- Stay out of insert mode. Edit in normal mode and only enter insert mode to type new text.
- Use . to repeat your last change and u to undo mistakes fearlessly.
- Learn one new command per day rather than trying to memorize the whole sheet at once.
Frequently Asked Questions
What is Vim?
Vim (Vi IMproved) is a fast, keyboard-driven text editor available on virtually every Unix, Linux and macOS system. It is modal, meaning keys do different things depending on the current mode (normal, insert, visual or command-line). Its efficiency comes from composing small commands together without touching the mouse.
How do I quit Vim?
Press Esc to make sure you are in normal mode, then type :q and press Enter to quit. If you have unsaved changes, use :q! to discard them and quit, or :wq (or ZZ) to save and quit at the same time.
How do I save a file in Vim?
From normal mode type :w and press Enter to write (save) the file. To save and quit in one step use :wq, :x or the shortcut ZZ. Use :wa to save every open buffer.
What is the difference between Vim modes?
Normal mode is for navigation and running commands, insert mode is for typing text (enter with i, a or o), visual mode is for selecting text (enter with v, V or Ctrl+v), and command-line mode runs ex commands such as :w and :s after you press ':'. Press Esc to return to normal mode from anywhere.
How do I find and replace text in Vim?
Use :%s/old/new/g to replace every occurrence of 'old' with 'new' in the whole file. Add a 'c' flag, :%s/old/new/gc, to confirm each replacement individually. Drop the % to limit the change to the current line.
Is this Vim cheat sheet free?
Yes. This cheat sheet is completely free, requires no sign-up, and runs entirely in your browser. You can search any command and click it to copy it to your clipboard.