Back to Blog Home

List Of Vi Commands

Rahul Bansal| Software | 5 months, 3 weeks



 

vi is a screen-oriented text editor originally created for the Unix operating system.

Here is a list of vi Commands

Keystroke Use
Shift+zz Save the file and quit
:w Save the file but keep it open
:q Quit without saving
:wq Save the file and quit

 

Keystroke Use
 k Move cursor up
 j Move cursor down
 h Move cursor left
 l

Move cursor right

 

Keystrokes Action
 i Insert at cursor (goes into insert mode)
 a Write after cursor (goes into insert mode)
 A Write at the end of line (goes into insert mode)
ESC Terminate insert mode
u Undo last change
U Undo all changes to the entire line
o Open a new line (goes into insert mode)
dd
3dd
Delete line
Delete 3 lines.
D Delete contents of line after the cursor
C Delete contents of a line after the cursor and insert new text. Press ESC key to end insertion.
dw
4dw
Delete word
Delete 4 words
cw Change word
x Delete character at the cursor
r Replace character
R Overwrite characters from cursor onward
s Substitute one character under cursor continue to insert
S Substitute entire line and begin to insert at the beginning of the line
~ Change case of individual character

 

 



Join 1000+ People Who Subscribe to Weekly Blog Updates

Back to Blog Home