home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Learning the vi Editor

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

A.2 Editing Commands

Insert
i , a Insert text before, after cursor
I , A Insert text at beginning, end of line
o , O Open new line for text below, above cursor
Change
r Change character
cw Change word
cc Change current line
C Change to end of line
R Type over characters
s Delete character and substitute text
S Delete current line and substitute text
Delete, move
x Delete character
X Delete character before cursor
dw Delete word
dd Delete current line
D Delete to end of line
p , P Put deleted text after, before cursor
" n p

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

Yank
yw Yank (copy) word
yy Yank current line
" a yy Yank current line into named buffer a
p , P Put yanked text after, before cursor
" a P Put text from buffer a before cursor
Other commands
. Repeat last edit command
u , U Undo last edit; restore current line
J Join two lines
ex edit commands
:d Delete lines
:m Move lines
:co or :t Copy lines
:.,$d Delete from current line to end of file
:30,60m0 Move 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 Commands Learning the vi Editor Next: A.3 Exit Commands
A.1 Movement Commands Book Index A.3 Exit Commands

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