Vim Essentials

CommandUsage

:wq

Save and close file

ddkP

Move a line up dd - deletes the line k - moves the cursor up P - pastes the line

ddp

Move a line down

:q!

Close file without saving changes

gg

Move to the first line of document

Shift+g

Move to the last line of document

:line-number

Move to the mentioned line

dd

Delete Line

yy

Copy Line

2yy

Copy 2 lines

p

Paste Line

"*p

Paste from system clipboard

Ctrl+j

begin new line during insert mode

Ctrl+w

delete word before cursor during insert mode

dw

delete from cursor position to beginning of next word

:reg

shows register contents

/pattern

search for pattern in file

?pattern

search backward for pattern in file

:set nowrap

to not have word wrap

Last updated