vi Editor#
Three Modes of vi Editor#
- Command mode (default mode)
- Insert mode [Press
ain command mode (insert text after the cursor)] or [Pressiin command mode (insert text before the cursor)] - Ex mode (prepare to exit vi editor) [Enter
:in command mode]
Ex Mode Commands#
:wqSave and exit (note thatwis for save,qis for exit, in that order,wqcannot be reversed):q!Force exit document (i.e., do not save and exit)
Appreciating the Advantages of vi Editor#
vi Editor Command Mode Commands#
yyCopy current linenyyCopy current n linesddDelete current linenddDelete current n linespPaste- Support for search function:
/text_to_search