/ Home

VI Commands

Note: TBW

Go edit mode:

i (press i)

Undo previous command:

u (press u)
Go closing/escape mode:

escape (press escape)

Save a file:

escape and then ZZ (double capital Z)
or

escape and then :wq!

Close a file without saving:

escape and then :q!

Delete line:

Go to particular line and press double d (dd)
You should be in escape mode (nopt insert mode)

Delete lines:

:3,5d
the above command will delete from line 3 to 5

Delete current character to end of the line:

D (press capital d)

Delete current word:

dw

Search word: (forward)

escape and then type /search_word_should_come_here

press n for nex occurrence

Search word: (backward)

?search_word_should_come_here

press n for nex occurrence

Ref Link here