Vi Commands

Kian
Tech Blog
Published in
1 min readJan 12, 2021

--

Photo by Leighann Blackwood on Unsplash

Vi commands that you should know

Editing Commands

vi <new filename> or <existing filename> — to make a file or edit

i : Insert at cursor

a : Write after cursor

A : Write at the end of line

o : open a new line

dd : Delete the line

D : Delete contents of line after the cursor

C : Delete contents of a line after the cursor and insert new text.

r : Replace character

R : Overwrite characters from cursor on ward

~ : Change case of individual character

ESC : Terminate insert mode

Moving Commands

k : Move cursor up

j : Move cursor down

h : Move cursor left

l : Move cursor right

Saving & Closing the file Commands

ESC : Terminate insert mode

Shift + zz : Save the file and quit

:w : Save the file staying open

:q : Quit with no saving

:wq : Save the file and quit

--

--