Vi command summary

Entering Edit Mode:

a=append text (after the cursor) i=insert text (directly under the cursor)

o (the letter “oh”) =open a new line under the current line O (capital “oh”)=open a new line above the current line

Command Mode:
0 (zero)= Move cursor to beginning of current line.
$= Move cursor to the end of current line.
x= delete the character under the cursor
X= delete the character before the cursor
dd= delete the entire line the cursor is on
:w= save and continue editing
:wq= save and quit (can use ZZ as well)
:q!= quit and discard changes
:wfilename= save a copy tofilename(save as)

The best way to save yourself from a messed up edit is to hit**followed by:q!** That command will quit without saving changes.

Another useful feature that can be used in command mode is the string search. To search for a particular string in a file, make sure you are in command mode and type

/**string**


**Where_string_is your search target. After issuing the command, youcan move on to the next hit by typing "n".

viis an extremely powerful editor. There are a huge number of commands and capabilities that are outside the scope of this guide. Seeman vifor more details. Keep in mind there are chapters in books devoted to this editor. There are even a couple of books devoted tovialone.

results matching ""

    No results matching ""