Sunday, February 17, 2013

Modes in Vi Editor

There are different modes in vi editor. These modes let you to write in text or execute command.
1) Command mode: This is default mode in linux when you enter or open a file using vi editor. you can cut/copy/delete/undo/paste commands in the command section.

Cut             x
Copy          yy
Paste          p
Undo          u
delete line   dd
delete word dw

2) Insertion mode: This mode is use for writing text in the file.For insertion mode you have to press 'i' on the keyboard. As you press 'i' your insertion mode is enabled.

3) Execute mode: This mode is use to execute command like save/save without exit/exit without save. For execution mode you have to press ESC when you complete your text then press
 colon (:) and then type following commands.

Save and quit              wq!
Save without quit      w!
Quit without Saving  q!

 

0 comments: