Полезная информация

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 8.2 Movement CommandsChapter 8
The Vi Editor
Next: 8.4 Saving and Exiting
 

8.3 Edit Commands

Recall that c, d, and y are the basic editing operators.

8.3.1 Inserting New Text

aAppend after cursor.
AAppend to end of line.
iInsert before cursor.
IInsert at beginning of line.
oOpen a line below cursor.
OOpen a line above cursor.
ESCTerminate insert mode.
CTRL-JMove down one line.
RETURNMove down one line.
CTRL-IInsert a tab.
CTRL-TMove to next tab setting.
BACKSPACEMove back one character.
CTRL-HMove back one character.
CTRL-UDelete current line.
CTRL-VQuote next character.
CTRL-WMove back one word.

The last four control characters are set by stty. Your terminal settings may differ.

8.3.2 Changing and Deleting Text

cwChange word.
ccChange line.
CChange text from current position to end of line.
ddDelete current line.
nddDelete n lines.
DDelete remainder of line.
dwDelete a word.
d}Delete up to next paragraph.
d^Delete back to beginning of line.
d/patDelete up to first occurrence of pattern.
dnDelete up to next occurrence of pattern.
dfaDelete up to and including a on current line.
dtaDelete up to (not including) a on current line.
dLDelete up to last line on screen.
dGDelete to end of file.
pInsert last deleted text after cursor.
PInsert last deleted text before cursor.
rxReplace character with x.
RtextReplace text beginning at cursor.
sSubstitute character.
4sSubstitute four characters.
SSubstitute entire line.
uUndo last change.
URestore current line.
xDelete current cursor position.
XDelete back one character.
5XDelete previous five characters.
.Repeat last change.
~Reverse case.

8.3.3 Copying and Moving

YCopy current line to new buffer.
yyCopy current line.
"xyyYank current line to buffer x.
"xdDelete into buffer x.
"XdDelete and append into buffer x.
"xpPut contents of buffer x.
y]]Copy up to next section heading.
yeCopy to end of word.


Previous: 8.2 Movement CommandsUNIX in a Nutshell: System V EditionNext: 8.4 Saving and Exiting
8.2 Movement CommandsBook Index8.4 Saving and Exiting

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System