vi Editor#
Three Modes of vi Editor#
- Command mode (default mode)
- Insert mode [Press
a
in command mode (insert text after the cursor)] or [Pressi
in command mode (insert text before the cursor)] - Ex mode (prepare to exit vi editor) [Enter
:
in command mode]
Ex Mode Commands#
:wq
Save and exit (note thatw
is for save,q
is for exit, in that order,wq
cannot be reversed):q!
Force exit document (i.e., do not save and exit)
Appreciating the Advantages of vi Editor#
vi Editor Command Mode Commands#
yy
Copy current linenyy
Copy current n linesdd
Delete current linendd
Delete current n linesp
Paste- Support for search function:
/text_to_search