Skip to content

Learn VIM motion

DUONG Phu-Hiep edited this page May 5, 2024 · 9 revisions

Move around

Message Key More
Goto first line gg
Goto End of File G
Goto Line nG
Show Line Number :set nu
Home, End _ g_ with whitespace: 0 $
Word forward/backward w b W B
Find char, Until char (forward, backward) f{char} t{char} F{char} T{char} ; , Jump to next and previous
Page forward/backward ^F ^B
1/2 Page down/up ^d ^u
Next / Previous Block prargraph: { } phrase: ( )
Bookmark 'a' and jump to 'a' ma 'a
Jump list Ctrl+I, Ctrl+O

Search

Message Key
Search Forward /text
Search Backward ?text
Next n
Previous N
Replace all old with new throughout file :%s/old/new/g

Copy Paste Cut

Message Key Other
Select Text v (V: select line)
Yank to default buffer " y
Yank to buffer "a" "ay
Paste from default buffer " p
Paste from buffer "a" "ap
Cut to default buffer " d
Cut to buffer "a" "ad

Undo

Message Key Other
Undo u 3u: undo 3 times
Redo Ctrl+R

Insert Replacement mode

Message Key Other
a add text (after cursor)
i insert text (before cursor)
substitute line S
change in word ciw
change to the next '{' ct{
change to end c$
Message Key Other
delete current line dd
yank current line yy
ident line << >> ==

https://vim.rtorr.com/