vi

vi is Unix's omnipresent, ubiquitous, cryptic command-line text editor.

There are two vi modes: Command mode and Insert mode. Table A.5 shows the commands that invoke Insert mode. Once you are in Insert mode, you get back to Command mode by pressing the Escape key.

vi Insert Commands
Insert CommandMeaning
aAppend after the cursor
AAppend at the end of the line
cBegin change operation
CChange to the end of the line
iInsert before the cursor
IInsert at the beginning of the line
oStart a blank line below the current line
OStart a blank line above the current line
RBegin overwriting text
sSubstitute a character
SSubstitute entire line

The normal cursor keys are not used to move around in vi. Table A.6 shows some vi movement commands.

Some vi Movement Commands
Movement CommandDescription
h,j,k,lMove left, down, up, and right (vi's cursor keys)
SpacebarMove right
w,W,b,BGo forward or backward by a word
e,EGo to the end of the word
)Go to the beginning of the next sentence
(Go to the beginning of the current sentence
0Go to the first position in the current line
$Go to the end of the current line
/textSearch forward for text
?textSearch backward for text

Table A.7 shows some vi text editing commands.

Some vi Text Editing Commands
CommandMeaning
cwChange the word
ccChange the line
CChange the text from the current position to the end of the line
ddDelete the current line
DDelete the remainder of the line
dwDelete the word
xDelete the current character
XDelete the previous character

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.89.2