Section 7.5. Edit Commands

7.5. Edit Commands

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

7.5.1. Inserting New Text

Command

Action

a

Append after cursor.

A

Append to end of line.

i

Insert before cursor.

I

Insert at first nonblank character of line.

gI

Insert at beginning of line. ( vim )

o

Open a line below cursor.

O

Open a line above cursor.

Esc

Terminate insert mode.


The following commands work in insert mode.

Command

Action

Tab

Insert a tab.

Backspace

Delete previous character.

Ctrl-E

Insert character found just below cursor. ( vim )

Ctrl-Y

Insert character found just above cursor. ( vim )

Ctrl-H

Delete previous character (same as Backspace).

Delete

Delete current character.

Ctrl-W

Delete previous word. ( vim )

Ctrl-A

Repeat last insertion. ( vim )

Ctrl-I

Insert a tab.

Ctrl-N

Insert next completion of the pattern to the left of the cursor. ( vim )

Ctrl-P

Insert previous completion of the pattern to the left of the cursor. ( vim )

Ctrl-T

Shift line right to next shift width. ( vim )

Ctrl-D

Shift line left to previous shift width. ( vim )

Ctrl-U

Delete current line.

Ctrl-V

Insert next character verbatim.

Ctrl-[

Terminate insert mode.


Some of the control characters listed in the previous table are set by stty . Your terminal settings may differ .

7.5.2. Changing and Deleting Text

The following table isn't 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$.

n dd

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 )

r x

Replace character with x .

Rtext

Replace text beginning at cursor.

s

Substitute character.

n s

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.

n X

Delete previous n characters.

.

Repeat last change.

~

Reverse case.

&

Repeat last substitution.

Y

Copy (yank) current line to temporary buffer.

yy

Same as Y.

" x yy

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.

" x dd

Delete current line into buffer x .

" X dd

Delete current line and append to buffer x .

" x p

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 )




MAC OS X Tiger in a Nutshell
Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009437
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net