Learning the vi Editor

Learning the vi EditorSearch this book
Previous: A.1 Movement CommandsAppendix A
Quick Reference
Next: A.3 Exit Commands
 

A.2 Editing Commands

Insert
i, aInsert text before, after cursor
I, AInsert text at beginning, end of line
o, OOpen new line for text below, above cursor
Change
rChange character
cwChange word
ccChange current line
CChange to end of line
RType over characters
sDelete character and substitute text
SDelete current line and substitute text
Delete, move
xDelete character
XDelete character before cursor
dwDelete word
ddDelete current line
DDelete to end of line
p, PPut deleted text after, before cursor
"np

Put text from delete buffer number n after cursor (for last nine deletions)

Yank
ywYank (copy) word
yyYank current line
"ayyYank current line into named buffer a
p, PPut yanked text after, before cursor
"aPPut text from buffer a before cursor
Other commands
.Repeat last edit command
u, UUndo last edit; restore current line
JJoin two lines
ex edit commands
:dDelete lines
:mMove lines
:co or :tCopy lines
:.,$dDelete from current line to end of file
:30,60m0Move lines 30 through 60 to top of file
:.,/pattern/co$

Copy from current line through line containing pattern to end of file


Previous: A.1 Movement CommandsLearning the vi EditorNext: A.3 Exit Commands
A.1 Movement CommandsBook IndexA.3 Exit Commands

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