You are on page 1of 2

Three modes in VI and VIM Editor

Command Mode
Cursor movement, change, delete, yank, put and search.
Insert Mode
Type in new text.
Ex mode
Configuring, exiting, saving, search and replace.

Command Mode.

Cursor Movement
h -> left
j -> down
k -> up
l -> right
w -> Word Ahead
b -> word back
( -> sentence back
) -> sentence forward
{ -> paragraph back
} -> paragraph below

Insert Mode

a -> append after the cursor


i -> insert before the cursor
o -> open a line below

A -> append to end of line


I -> insert at beginning of line
O -> open a line above

<Esc> -> Leave insert mode

Change Delete Yank Put (Paste)


(Copy)
Below Above
Line cc dd yy p P
Letter Cl Dl yl p (after) P (before)
Word Cw Dw Yw
Sentence ahead C( D( Y(
Sentence behind c) d) y)
Paragraph above C{ D{ Y{
Paragraph belov C} D} Y}
Undoing Changes
u -> undo most recent change
U -> undo all changes to the current line since the cursor landed on the line
<Ctrl – r> -> redo last “undone” change.

Search Text
/text -> search downwards for “text”
?text -> search upwards for “text”
n -> continue search in same direction
N -> continue search in opposite direction

:1,$s/\/dev\/java/\/dev1\/jre/

Saving and Exiting: Ex Mode

Save changes Abandon Changes


Exit :wq :q or :q!
Do not exit :q :e!

Forcing changes Save changes


Exit :wq!
Do not exit :w!

You might also like