Edit Commands

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

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.

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 ...

Get Mac OS X Panther in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.