Vim Cheatsheet

190+ Vim commands and keybindings. Click a mode to explore its commands. Search by key sequence or description.

Showing 107 of 107 Normal mode commands

h

Move cursor left

j

Move cursor down

k

Move cursor up

l

Move cursor right

w

Jump to start of next word

b

Jump to start of previous word

e

Jump to end of current/next word

W

Jump to start of next WORD (whitespace-delimited)

B

Jump to start of previous WORD

E

Jump to end of current/next WORD

0

Jump to start of line

^

Jump to first non-blank character of line

$

Jump to end of line

gg

Go to first line of file

G

Go to last line of file

{

Jump to previous empty line (paragraph back)

}

Jump to next empty line (paragraph forward)

(

Jump to start of previous sentence

)

Jump to start of next sentence

%

Jump to matching bracket/parenthesis

f{char}

Jump to next occurrence of {char} on line

F{char}

Jump to previous occurrence of {char} on line

t{char}

Jump to before next occurrence of {char} on line

T{char}

Jump to after previous occurrence of {char} on line

;

Repeat last f/F/t/T motion forward

,

Repeat last f/F/t/T motion backward

H

Jump to top of screen

M

Jump to middle of screen

L

Jump to bottom of screen

Ctrl+d

Scroll down half a screen

Ctrl+u

Scroll up half a screen

Ctrl+f

Scroll down a full screen

Ctrl+b

Scroll up a full screen

i

Enter Insert mode before cursor

I

Enter Insert mode at start of line

a

Enter Insert mode after cursor

A

Enter Insert mode at end of line

o

Open new line below and enter Insert mode

O

Open new line above and enter Insert mode

r{char}

Replace character under cursor with {char}

R

Enter Replace mode (overwrite characters)

s

Delete character under cursor and enter Insert mode

S

Delete entire line and enter Insert mode

c{motion}

Change (delete + enter Insert) over motion

C

Change from cursor to end of line

cc

Change (replace) entire line

~

Toggle case of character under cursor

u

Undo last change

Ctrl+r

Redo last undone change

.

Repeat last change

={motion}

Auto-indent over motion

==

Auto-indent current line

x

Delete character under cursor

X

Delete character before cursor

d{motion}

Delete over motion (e.g. dw, db, de)

dd

Delete entire current line

D

Delete from cursor to end of line

dw

Delete word from cursor

db

Delete word backwards

de

Delete to end of word

dG

Delete from current line to end of file

dgg

Delete from current line to start of file

y{motion}

Yank (copy) over motion

yy

Yank entire current line

Y

Yank to end of line (same as yy in most configs)

yw

Yank word from cursor

yb

Yank word backwards

p

Paste after cursor / below line

P

Paste before cursor / above line

/{pattern}

Search forward for pattern

?{pattern}

Search backward for pattern

n

Repeat search in same direction

N

Repeat search in opposite direction

*

Search forward for word under cursor

#

Search backward for word under cursor

:s/foo/bar/g

Replace all foo with bar on current line

:%s/foo/bar/g

Replace all foo with bar in entire file

:%s/foo/bar/gc

Replace with confirmation for each match

m{a-z}

Set mark {a-z} at cursor position

`{a-z}

Jump to mark {a-z} (exact position)

'{a-z}

Jump to line of mark {a-z}

``

Jump to position before last jump

''

Jump to line before last jump

q{a-z}

Start recording macro into register {a-z}

q

Stop recording macro

@{a-z}

Execute macro stored in register {a-z}

@@

Re-execute last macro

{N}@{a-z}

Execute macro N times

Ctrl+w s

Split window horizontally

Ctrl+w v

Split window vertically

Ctrl+w w

Switch to next window

Ctrl+w h

Move to window on the left

Ctrl+w j

Move to window below

Ctrl+w k

Move to window above

Ctrl+w l

Move to window on the right

Ctrl+w q

Close current window

Ctrl+w +

Increase window height

Ctrl+w -

Decrease window height

Ctrl+w =

Make all windows equal size

J

Join current line with next line

gJ

Join lines without inserting space

>>

Indent current line

<<

Unindent current line

ZZ

Save file and quit

ZQ

Quit without saving

ga

Show ASCII value of character under cursor

Ctrl+g

Show file status and cursor position