vi Editor#
Three Modes of vi Editor#
- Command mode (default mode)
- Insert mode [press a in command mode (insert text after the cursor)] or [press i in command mode (insert text before the cursor)]
- Last line mode (prepare to exit vi editor) [input :(colon in English)]
Commands in Last Line Mode#
:wq
save and exit (note that w is for save, q is for exit, in that order, do not reverse wq):q!
force exit document (i.e., do not save and exit)
Appreciating the Advantages of vi Editor#
Commands in vi Editor Command Mode#
yy
copy current linenyy
copy current n linesdd
delete current linendd
delete current n linesp
paste- Support for search function:
/function you want to search for