Modes

Action Shortcut
Enter insert mode (before cursor) iii
Enter insert mode (after cursor) aaa
Enter visual mode (character) vvv
Enter visual line mode ShiftVShiftVShiftV
Enter visual block mode CtrlVCtrlVCtrlV
Enter command-line mode :::
Enter replace mode ShiftRShiftRShiftR
Return to normal mode EscEscEsc
Return to normal mode (alternative) Ctrl[Ctrl[Ctrl[
Insert at beginning of line ShiftIShiftIShiftI

Movement

Action Shortcut
Move left hhh
Move down jjj
Move up kkk
Move right lll
Move forward to start of next word www
Move backward to start of previous word bbb
Move to end of word eee
Move to beginning of line 000
Move to first non-blank character of line ^^^
Move to end of line $$$
Go to first line of file gggggg
Go to last line of file ShiftGShiftGShiftG
Jump to next paragraph }}}
Jump to previous paragraph {{{
Jump to matching bracket %%%
Move to top of screen ShiftHShiftHShiftH
Move to middle of screen ShiftMShiftMShiftM
Move to bottom of screen ShiftLShiftLShiftL

Editing

Action Shortcut
Insert before cursor iii
Append after cursor aaa
Append at end of line ShiftAShiftAShiftA
Open new line below ooo
Open new line above ShiftOShiftOShiftO
Delete character under cursor xxx
Delete word dwdwdw
Delete entire line dddddd
Delete to end of line ShiftDShiftDShiftD
Change word cwcwcw
Change entire line cccccc
Replace single character rrr
Join current line with next line ShiftJShiftJShiftJ

Copy & Paste

Action Shortcut
Yank (copy) entire line yyyyyy
Yank word ywywyw
Yank to end of line y$y$y$
Paste after cursor ppp
Paste before cursor ShiftPShiftPShiftP
Yank into register a "ayy"ayy"ayy
Paste from register a "ap"ap"ap
Yank to system clipboard "+y"+y"+y
Paste from system clipboard "+p"+p"+p
Delete line and yank to register "add"add"add

Search & Replace

Action Shortcut
Search forward ///
Search backward ???
Next search match nnn
Previous search match ShiftNShiftNShiftN
Search word under cursor (forward) ***
Search word under cursor (backward) ###
Search and replace on current line :s/old/new/g:s/old/new/g:s/old/new/g
Search and replace in entire file :%s/old/new/g:%s/old/new/g:%s/old/new/g
Clear search highlighting :noh:noh:noh

Visual Mode

Action Shortcut
Start character-wise visual selection vvv
Start line-wise visual selection ShiftVShiftVShiftV
Start block visual selection CtrlVCtrlVCtrlV
Select all ggShiftVShiftGggShiftVShiftGggShiftVShiftG
Indent selection right >>>
Indent selection left <<<
Change selected text to uppercase ShiftUShiftUShiftU
Change selected text to lowercase uuu
Toggle case of selection ~~~
Sort selected lines :sort:sort:sort
Reselect last visual selection gvgvgv

File Operations

Action Shortcut
Write (save) file :w:w:w
Quit :q:q:q
Write and quit :wq:wq:wq
Force quit without saving :q!:q!:q!
Save file as :w filename:w filename:w filename
Edit (open) a file :e filename:e filename:e filename
Open horizontal split :sp:sp:sp
Open vertical split :vs:vs:vs
Open new tab :tabnew:tabnew:tabnew
Go to next tab gtgtgt
Go to previous tab gShiftTgShiftTgShiftT
Switch between splits CtrlWwCtrlWwCtrlWw

Advanced

Action Shortcut
Record macro into register q qqqqqq
Stop recording macro qqq
Play back macro from register q @q@q@q
Replay last macro @@@@@@
Set mark a mamama
Jump to mark a 'a'a'a
Jump to previous position CtrlOCtrlOCtrlO
Jump to next position CtrlICtrlICtrlI
Toggle fold zazaza
Undo uuu
Redo CtrlRCtrlRCtrlR
Repeat last command ...
Increment number under cursor CtrlACtrlACtrlA
Decrement number under cursor CtrlXCtrlXCtrlX
No shortcuts found. Try a different search term.

Frequently Asked Questions

How do I exit Vim?
To quit Vim, press Esc to ensure you are in normal mode, then type :q and press Enter. If you have unsaved changes, use :wq to save and quit, or :q! to quit without saving. This is one of the most common questions for new Vim users.
What is the difference between normal mode, insert mode, and visual mode in Vim?
Normal mode is the default mode for navigating and running commands. Insert mode (entered with i, a, o, etc.) is for typing text. Visual mode (entered with v, V, or Ctrl+V) is for selecting text. Press Esc at any time to return to normal mode. Understanding modes is fundamental to using Vim efficiently.
How do I copy and paste in Vim?
In normal mode, press yy to yank (copy) the current line and p to paste it after the cursor. Use y with a motion (such as yw for a word) to yank specific text. To copy to the system clipboard, use "+y and to paste from it use "+p. In visual mode, select text first, then press y to yank.
How do I search and replace text across an entire file in Vim?
Use the command :%s/old/new/g and press Enter. The % means the entire file, s is substitute, and the g flag replaces all occurrences on each line. Add a c flag (:%s/old/new/gc) to confirm each replacement interactively. For a single line, omit the % and use :s/old/new/g.
What are Vim macros and how do I use them?
Macros let you record a sequence of keystrokes and replay them. Press qq to start recording into register q, perform your edits, then press q again to stop recording. Play the macro with @q, and repeat it with @@. You can run a macro multiple times by prefixing a count, such as 10@q to run it 10 times. Macros are powerful for repetitive editing tasks.