Vim Dictionary
Complete reference for Vim motions and commands. Organized by category with thoughtful typography and visual hierarchy.
In Vim Gym Modules
44 motionsThese motions are covered in our interactive exercises
Movement
15h
Move left
j
Move down
k
Move up
l
Move right
w
Move to start of next word
e
Move to end of current word
b
Move to start of previous word
0
Move to beginning of line
_
Move to first non-blank character
$
Move to end of line
f
Find next occurrence of character
F
Find previous occurrence of character
;
Repeat last find command
{n}j
Jump down n lines
{n}k
Jump up n lines
Editing
14o
Create new line below and enter insert mode
O
Create new line above and enter insert mode
s
Delete character and substitute text
x
Delete character under cursor
r
Replace single character
dd
Delete entire line
D
Delete to end of line
yy
Yank (copy) current line
p
Put (paste) after cursor
P
Put (paste) before cursor
:s/old/new/
Replace first occurrence on current line
:s/old/new/g
Replace all occurrences on current line
:%s/old/new/g
Replace all occurrences in file
:%s/old/new/gc
Replace with confirmation
Mode
7Esc
Normal mode (navigate)
i
Insert mode (type)
a
Enter insert mode after cursor
I
Move to beginning of line and enter insert mode
A
Move to end of line and enter insert mode
v
Character-wise visual mode
V
Line-wise visual mode
Search
4/
Search forward
?
Search backward
n
Next search result
N
Previous search result
Advanced
4qa
Start recording macro in register a
q
Stop recording macro
@a
Replay macro from register a
@@
Replay last executed macro
Additional Commands
Other Common Vim Motions
246 motionsAdditional Vim motions and commands commonly used by experienced users
Editing
84dw
Delete word
d$
Delete to end of line
d0
Delete to beginning of line
dG
Delete to end of file
dgg
Delete to beginning of file
diw
Delete inner word
daw
Delete a word (including surrounding spaces)
di"
Delete inside quotes
da"
Delete around quotes
di(
Delete inside parentheses
da(
Delete around parentheses
X
Delete character before cursor
yw
Yank word
y$
Yank to end of line
y0
Yank to beginning of line
yG
Yank to end of file
ygg
Yank to beginning of file
yi"
Yank inside quotes
ya"
Yank around quotes
yi(
Yank inside parentheses
ya(
Yank around parentheses
~
Toggle case of selection
u
Make selection lowercase
U
Make selection uppercase
>
Indent selection right
<
Indent selection left
:s//
Repeat last substitution
u
Undo last change
Ctrl+r
Redo
U
Undo all changes on current line
guu
Make line lowercase
gUU
Make line uppercase
guw
Make word lowercase
gUw
Make word uppercase
g~
Toggle case of motion
J
Join current line with next line
gJ
Join lines without space
gq
Format lines to textwidth
gw
Format and restore cursor position
gr
Replace single character without entering insert mode
Ctrl+w
Delete word before cursor (insert mode)
Ctrl+u
Delete to start of line (insert mode)
Ctrl+h
Delete character before cursor (insert mode)
Ctrl+t
Indent line right (insert mode)
Ctrl+d
Indent line left (insert mode)
Ctrl+a
Insert previously inserted text (insert mode)
Ctrl+@
Insert previously inserted text and stop insert (insert mode)
Ctrl+v
Insert next character literally (insert mode)
:w
Write (save) file
:w!
Force write file
:q
Quit
:q!
Quit without saving
:wq
Write and quit
:x
Write and quit (only if modified)
:e {file}
Edit file
:e!
Reload file from disk
:saveas {file}
Save file with new name
das
Delete a sentence
dap
Delete a paragraph
db
Delete to beginning of word
de
Delete to end of word
d^
Delete to first non-blank character
dj
Delete current and next line
dk
Delete current and previous line
d{j}
Delete to beginning of paragraph
d{
Delete to beginning of paragraph
d}
Delete to end of paragraph
yas
Yank a sentence
yap
Yank a paragraph
yb
Yank to beginning of word
ye
Yank to end of word
y^
Yank to first non-blank character
y{
Yank to beginning of paragraph
y}
Yank to end of paragraph
yG
Yank to end of file
~
Toggle case of character under cursor
g~{motion}
Toggle case of motion
gU{motion}
Make motion uppercase
gu{motion}
Make motion lowercase
.
Repeat last change
g.
Repeat last change with count adjusted
x
Delete selection (visual mode)
s
Substitute selection (visual mode)
=
Indent selection automatically (visual mode)
Advanced
78m{a-z}
Set mark at current position
`{a-z}
Jump to mark
'{a-z}
Jump to line of mark
``
Jump to position before last jump
''
Jump to line before last jump
m{A-Z}
Set file mark (works across files)
"{a-z}y
Yank to named register
"{a-z}p
Put from named register
"0p
Put from yank register
"+y
Yank to system clipboard
"+p
Put from system clipboard
iw
Inner word text object
aw
A word text object
iW
Inner WORD text object
aW
A WORD text object
is
Inner sentence text object
as
A sentence text object
ip
Inner paragraph text object
ap
A paragraph text object
it
Inner tag text object
at
A tag text object
Ctrl+w s
Split window horizontally
Ctrl+w v
Split window vertically
Ctrl+w w
Switch between windows
Ctrl+w q
Close current window
Ctrl+w h/j/k/l
Navigate to window direction
:tabnew
Open new tab
gt
Go to next tab
gT
Go to previous tab
{n}gt
Go to tab number n
Ctrl+r {reg}
Insert contents of register (insert mode)
Ctrl+x Ctrl+f
File name completion (insert mode)
Ctrl+x Ctrl+l
Line completion (insert mode)
:bn
Next buffer
:bp
Previous buffer
:bd
Delete (close) buffer
:b {n}
Go to buffer number n
:b#
Switch to previous buffer
:buffers
List all buffers
:ls
List all buffers (short form)
:ball
Open all buffers in windows
:split
Split window horizontally
:sp
Split window horizontally (short)
:vsplit
Split window vertically
:vs
Split window vertically (short)
:split {file}
Split and edit file
:close
Close current window
:only
Close all windows except current
:resize {n}
Resize window to n lines
:vertical resize {n}
Resize window to n columns
:g/{pat}/
Execute command on lines matching pattern
:v/{pat}/
Execute command on lines not matching pattern
:marks
List all marks
:jumps
List jump history
:changes
List change history
:reg
List all registers
:registers
List all registers (long form)
:set {option}
Set option
:set number
Show line numbers
:set nonumber
Hide line numbers
:set relativenumber
Show relative line numbers
:set wrap
Enable line wrapping
:set nowrap
Disable line wrapping
ib
Inner bracket/parentheses text object
ab
A bracket/parentheses text object
i[
Inner square bracket text object
a[
A square bracket text object
i]
Inner square bracket text object
a]
A square bracket text object
i{
Inner curly brace text object
a{
A curly brace text object
i}
Inner curly brace text object
a}
A curly brace text object
i<
Inner angle bracket text object
a<
A angle bracket text object
i>
Inner angle bracket text object
a>
A angle bracket text object
:history
Show command-line history
Movement
42W
Move to start of next WORD (ignore punctuation)
E
Move to end of WORD
B
Move to start of previous WORD
ge
Move to end of previous word
gE
Move to end of previous WORD
g0
Move to first character in line (not first non-blank)
g^
Move to first non-blank character
g$
Move to last character in line
gm
Move to middle of line
H
Move to top of screen (first line)
M
Move to middle of screen
L
Move to bottom of screen (last line)
zt
Scroll line to top of screen
zz
Center line on screen
zb
Scroll line to bottom of screen
{
Move to previous paragraph
}
Move to next paragraph
(
Move to previous sentence
)
Move to next sentence
t{char}
Move cursor before next occurrence of character
T{char}
Move cursor after previous occurrence of character
,
Repeat last f, F, t, or T in opposite direction
G
Jump to end of file
gg
Jump to beginning of file
{n}G
Jump to line number n
Ctrl+o
Jump to older position in jump list
Ctrl+i
Jump to newer position in jump list
Ctrl+u
Move half screen up
Ctrl+d
Move half screen down
Ctrl+b
Move one screen up
Ctrl+f
Move one screen down
Ctrl+e
Scroll window down
Ctrl+y
Scroll window up
:n
Go to line n
:{n}
Go to line n (short form)
:$
Go to last line
%
Match corresponding bracket/parenthesis/brace
g%
Match corresponding item (more flexible)
[[
Move to previous section
]]
Move to next section
[]
Move to end of previous section
][
Move to end of next section
Mode
24S
Delete entire line and enter insert mode
cc
Delete entire line and enter insert mode
cw
Delete to end of word and enter insert mode
c$
Delete to end of line and enter insert mode
ciw
Change inner word (delete word and enter insert)
ci"
Change inside quotes
ci(
Change inside parentheses
ci[
Change inside square brackets
ci{
Change inside curly braces
ca"
Change around quotes (including quotes)
Ctrl+v
Block visual mode
gv
Reselect last visual selection
R
Enter replace mode (overwrite characters)
gR
Enter virtual replace mode (handles tabs as spaces)
caw
Change a word (including surrounding spaces)
cas
Change a sentence
cap
Change a paragraph
ciB
Change inside { } block
caB
Change around { } block
ci}
Change inside } block
ca}
Change around } block
I
Insert at beginning of selection (visual block)
A
Append at end of selection (visual block)
c
Change selection (visual mode)
Search
18*
Search for word under cursor forward
#
Search for word under cursor backward
g*
Search for partial word under cursor forward
g#
Search for partial word under cursor backward
Ctrl+n
Next match in completion (insert mode)
Ctrl+p
Previous match in completion (insert mode)
:%
Go to line matching pattern
:grep {pattern}
Search using external grep
:vimgrep {pattern} {files}
Search in files
:cn
Next match from :grep
:cp
Previous match from :grep
:set hlsearch
Highlight search results
:set nohlsearch
Disable search highlighting
:nohlsearch
Temporarily disable search highlighting
:set ignorecase
Ignore case in searches
:set smartcase
Smart case in searches
/{pattern}/e
Move cursor to end of match
/{pattern}/b{offset}
Move cursor {offset} characters before match