Vim commands and shortcuts

Vim is a keyboard-driven text editor: you switch between modes to move, type, and change text. The commands here move the cursor, edit with operators and registers, search and replace, and handle windows, buffers, and files.

Windows, macOS, Linux · 69 shortcuts

Modes and movement

Start in normal mode, move by character or text object, and use the same motions as building blocks for operators.

ActionShortcuts
Insert before the cursor
Windows / macOS / Linuxi
Insert after the cursor
Windows / macOS / Linuxa
Insert at the first non-blank character
Windows / macOS / LinuxI
Append at the end of the line
Windows / macOS / LinuxA
Open a new line below
Windows / macOS / Linuxo
Open a new line above
Windows / macOS / LinuxO
Return to normal mode
Windows / macOS / LinuxEsc
Move left
Windows / macOS / Linuxh
Move down
Windows / macOS / Linuxj
Move up
Windows / macOS / Linuxk
Move right
Windows / macOS / Linuxl
Move to the first non-blank character0 moves to column one.
Windows / macOS / Linux^
Move to the end of the line
Windows / macOS / Linux$
Move to the next word start
Windows / macOS / Linuxw
Move to the previous word start
Windows / macOS / Linuxb
Move to the next word end
Windows / macOS / Linuxe
Move to the start of the file
Windows / macOS / Linuxg then g
Move to the end of the file
Windows / macOS / LinuxG
Jump to the matching bracket or parenthesis
Windows / macOS / Linux%
Jump to the older cursor positionCtrl+i jumps forward through the jump list.
Windows / macOS / LinuxCtrl + o
Find a character forward on the lineType f then the character. t lands just before it; F and T search backward.
Windows / macOS / Linuxf

Editing and registers

Use operators with motions, change or delete text, work with registers, and repeat edits in normal mode.

ActionShortcuts
Delete the current line
Windows / macOS / Linuxd then d
Delete the character under the cursorX deletes the character before the cursor.
Windows / macOS / Linuxx
Delete from the cursor to line end
Windows / macOS / LinuxD
Change the word under the cursorThe ci text-object pattern also works with parentheses, quotes, and other objects.
Windows / macOS / Linuxc then i then w
Change the whole line
Windows / macOS / Linuxc then c
Change from the cursor to line end
Windows / macOS / LinuxC
Replace one characterType r then the replacement character.
Windows / macOS / Linuxr
Join the current line with the next
Windows / macOS / LinuxJ
Copy (yank) the current line
Windows / macOS / Linuxy then y
Copy text covered by a motionPress y then a motion, such as yw or y$.
Windows / macOS / Linuxy
Paste after the cursorP pastes before the cursor.
Windows / macOS / Linuxp
Undo the last change
Windows / macOS / Linuxu
Redo an undone change
Windows / macOS / LinuxCtrl + r
Repeat the last change
Windows / macOS / Linux.
Toggle the case of the character
Windows / macOS / Linux~
Start character-wise visual mode
Windows / macOS / Linuxv
Start line-wise visual mode
Windows / macOS / LinuxV
Start block-wise visual mode
Windows / macOS / LinuxCtrl + v
Indent the selected or motion range right
Windows / macOS / Linux>
Indent the selected or motion range left
Windows / macOS / Linux<

Search, replace, and folds

Search forward or backward, move through matches, replace text, and reveal or hide folded code.

ActionShortcuts
Search forwardType a pattern and press Enter. ? searches backward.
Windows / macOS / Linux/
Go to the next search matchN goes to the previous match.
Windows / macOS / Linuxn
Search forward for the word under the cursor# searches backward.
Windows / macOS / Linux*
Clear search highlighting
Windows / macOS / Linux: then nohlsearch
Replace text on the current lineFor example, :s/old/new/g replaces every match on the line.
Windows / macOS / Linux: then s
Replace text across the fileFor example, :%s/old/new/g replaces every match in the file.
Windows / macOS / Linux: then % then s
Open or close the fold under the cursor
Windows / macOS / Linuxz then a
Close the fold under the cursor
Windows / macOS / Linuxz then c
Open the fold under the cursor
Windows / macOS / Linuxz then o
Open all folds
Windows / macOS / Linuxz then R
Close all folds
Windows / macOS / Linuxz then M

Windows, files, and commands

The Ctrl+w prefix manages windows; command-line entries save, quit, edit, and move through files and buffers.

ActionShortcuts
Split the window horizontally
Windows / macOS / LinuxCtrl + w then s
Split the window vertically
Windows / macOS / LinuxCtrl + w then v
Move to the next window
Windows / macOS / LinuxCtrl + w then w
Move to the window on the left
Windows / macOS / LinuxCtrl + w then h
Move to the window below
Windows / macOS / LinuxCtrl + w then j
Move to the window above
Windows / macOS / LinuxCtrl + w then k
Move to the window on the right
Windows / macOS / LinuxCtrl + w then l
Close the current window
Windows / macOS / LinuxCtrl + w then q
Equalize window sizes
Windows / macOS / LinuxCtrl + w then =
Write the current file
Windows / macOS / Linux: then w
Quit Vim:wq or :x writes and quits; :q! quits without saving.
Windows / macOS / Linux: then q
Write and quit
Windows / macOS / Linux: then w then q
Quit without saving
Windows / macOS / Linux: then q then !
Edit a fileType :e followed by a path, then press Enter.
Windows / macOS / Linux: then e
Edit the next buffer
Windows / macOS / Linux: then bn
Edit the previous buffer
Windows / macOS / Linux: then bp
Open the command-line prompt
Windows / macOS / Linux:

Source

official Vim quick reference · Checked

Core Vim 9.2 behavior from the official Vim quick reference checked in August 2026. Commands are typed inside Vim, so the same keys apply on Windows, macOS, and Linux; terminal or GUI mappings can change them.

Make a printable Vim sheet