Skip to content

tsukiy0's blog

Vim Cheatsheet

May 02, 2019

Modes

ModeCommandDescription
NORMALescmovement
INSERTi, aediting
VISUALvselecting
COMMAND:run vim commands

Movement

Letter

ModeCommandDescription
NORMALjdown
NORMALkup
NORMALlright
NORMALhleft

Line

ModeCommandDescription
NORMALwword start
NORMALeword end
NORMAL0line start
NORMAL$line end

File

ModeCommandDescription
NORMAL]jump down to next empty line
NORMAL[jump up to next empty line
NORMALggtop
NORMALGbottom

Files

ModeCommandDescription
NORMALCtrl-oback
NORMALCtrl-iforward
NORMALCtrl-w vnew window to the right
NORMALCtrl-w lmove to right window
NORMALCtrl-w hmove to left window

Editing

ModeCommandDescription
VISUALycopy selected
NORMALyycopy line
NORMALyecopy until word end
NORMALyi[x]copy in x
NORMALya[x]copy around x
NORMALyt[x]copy until x
NORMALppaste
VISUALdcut
NORMALddcut line
NORMALdi[x]cut in x
NORMALda[x]cut around x
NORMALdt[x]cut until x
NORMALr[x]replace character with x
NORMALxcut character
NORMALonew line and enter INSERT mode
COMMAND%s/[x]/[y]/greplace [x] with [y]
NORMALysiw[x]surround word with [x]
NORMALyss[x]surround line with [x]
VISUALS[x]surround selected with [x]
NORMALds[x]remove surround matching [x]

Workflow

ModeCommandDescription
NORMALq[x]...qrecord ... macro to character [x]
NORMAL@[x]replay macro stored at character[x]
NORMAL/[x]search matching [x]

tsukiy0