Читать книгу Linux Bible - Christopher Negus - Страница 150

Deleting, copying, and changing text

Оглавление

The only other editing that you need to know is how to delete, copy, or change text. The x, d, y, and c commands can be used to delete and change text. These can be used along with movement keys (arrows, PgUp, PgDn, letters, and special keys) and numbers to indicate exactly what you are deleting, copying, or changing. Consider the following examples:

 x: Deletes the character under the cursor.

 X: Deletes the character directly before the cursor.

 d<?>: Deletes some text.

 c<?>: Changes some text.

 y<?>: Yanks (copies) some text.

The <?> after each letter in the preceding list identifies the place where you can use a movement command to choose what you are deleting, changing, or yanking. For example:

 dw: Deletes (d) a word (w) after the current cursor position.

 db: Deletes (d) a word (b) before the current cursor position.

 dd: Deletes (d) the entire current line (d).

 c$: Changes (c) the characters (actually erases them) from the current character to the end of the current line ($) and goes into input mode.

 c0: Changes (c) (again, erases) characters from the previous character to the beginning of the current line (0) and goes into input mode.

 cl: Erases (c) the current letter (l) and goes into input mode.

 cc: Erases (c) the line (c) and goes into input mode.

 yy: Copies (y) the current line (y) into the buffer.

 y): Copies (y) the current sentence ( ) ), to the right of the cursor, into the buffer.

 y}: Copies (y) the current paragraph ( } ), to the right of the cursor, into the buffer.

Any of the commands just shown can be further modified using numbers, as you can see in the following examples:

 3dd: Deletes (d) three (3) lines (d), beginning at the current line.

 3dw: Deletes (d) the next three (3) words (w).

 5cl: Changes (c) the next five (5) letters (l) (that is, removes the letters and enters input mode).

 12j: Moves down (j) 12 lines (12).

 5cw: Erases (c) the next five (5) words (w) and goes into input mode.

 4y): Copies (y) the next four (4) sentences ( ) ).

Linux Bible

Подняться наверх