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


Linux in a NutshellLinux in a NutshellSearch this book

11.5. Edit Commands

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

11.5.2. Changing and Deleting Text

The following table is not exhaustive, but illustrates the most common operations.

Command

Action

cw

Change through end of current word.

cc

Change line.

c$

Change text from current position to end-of-line.

C

Same as c$.

dd

Delete current line.

d$

Delete remainder of line.

D

Same as d$.

ndd

Delete n lines.

dw

Delete a word.

d}

Delete up to next paragraph.

d^

Delete back to beginning of line.

d/pattern

Delete up to first occurrence of pattern.

dn

Delete up to next occurrence of pattern.

dfa

Delete up to and including a on current line.

dta

Delete up to (not including) a on current line.

dL

Delete up to last line on screen.

dG

Delete to end-of-file.

gqap

Reformat current paragraph to textwidth. {vim}

g~w

Switch case of word. {vim}

guw

Change word to lowercase. {vim}

gUw

Change word to uppercase. {vim}

p

Insert last deleted or yanked text after cursor.

gp

Same as p, but leave cursor at end of inserted text. {vim}

]p

Same as p, but match current indention. {vim}

[p

Same as P, but match current indention. {vim}

P

Insert last deleted or yanked text before cursor.

gP

Same as P, but leave cursor at end of inserted text. {vim}

rx

Replace character with x.

Rtext

Replace text beginning at cursor.

s

Substitute character.

ns

Substitute n characters.

S

Substitute entire line.

u

Undo last change.

Ctrl-R

Redo last change. {vim}

U

Restore current line.

x

Delete current character.

X

Delete back one character.

nX

Delete previous n characters.

.

Repeat last change.

~

Reverse case.

&

Repeat last substitution.

Y

Copy (yank) current line to temporary buffer.

yy

Same as Y.

"xyy

Copy current line to buffer x.

ye

Copy text to end of word into temporary buffer.

yw

Same as ye.

y$

Copy rest of line into temporary buffer.

"xdd

Delete current line into buffer x.

"Xdd

Delete current line and append to buffer x.

"xp

Put contents of buffer x.

J

Join previous line to current line.

gJ

Same as J, but without inserting a space. {vim}

:j!

Same as J.

Ctrl-A

Increment number under cursor. {vim}

Ctrl-X

Decrement number under cursor. {vim}



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.