-->
Previous | Table of Contents | Next |
When emacs finds an occurrence of Linux, it stops and prompts for an action. The possible responses are as follows:
Keystroke | Action |
---|---|
<Ctrl-g> | Cancels operation |
<!> | Replaces the rest without prompting |
<?> | Gets a list of options |
<.> | Replaces the current instance and quits |
<,> | Replaces current instance but doesnt move on to next instance |
<y> or Spacebar | Replaces and continues with replace operation |
<n> | Doesnt replace but continues with replace operation |
Changing Text
Another editing task youre often faced with is changing text or replacing one text string with another (there isnt too much difference between the two operations). You use the replace commands to replace a single character or sequence of characters. You can also use the change commands to fix one of the most common typing mistakes madetransposing two letters. Table 28.3 summarizes the change commands.
Keystroke | Action |
---|---|
<Ctrl-t> | Transposes two adjacent letters |
<Esc><t> | Transposes two words |
<Ctrl-x><Ctrl-t> | Transposes two lines |
<Esc><c> | Properly capitalizes the word (initial capitalization) |
<Esc><l> | Lowercases the entire word |
<Esc><u> | Uppercases the entire word |
The changes take place relative to the position of the cursor. Position the cursor at the location in the buffer file you want to correct before using these commands.
When you delete or cut characters, words, lines, or a portion of a line, the deleted object is saved in whats called the kill buffer. The name isnt too important; whats important is that you can put or paste the contents of the kill buffer anywhere in the text youre editing. You do that with <Ctrl-y>, the yank command. <Ctrl-y> pastes the object to the right of or after the cursor position.
Here is an example showing the use of <Ctrl-y> to paste the contents of the kill buffer after the cursor:
Before:
Carefully carry these out instructions.
Delete the word out and a space by pressing <Esc-d>. Now move the cursor to the space after the y in carry and press <Ctrl-y>.
After:
Carefully carry out these instructions.
To copy a sequence of four lines to another portion of the text, you must first mark the four lines of text, delete them to the kill buffer, and then yank them back at the appropriate places. Follow these steps:
TROUBLESHOOTING:
I deleted the marked region, but the region I marked wasnt deleted. Unfortunately, GNU emacs supplied with Linux doesnt display any type of marker to indicate the mark, so its very easy to forget to set the mark or to place it in an inappropriate position. To check the position of the mark, use the command <Ctrl-x><Ctrl-x>. This command swaps the position of the cursor and the mark. If the cursor moves to the position where you thought the mark was located, you know the mark is properly set. To move the cursor back to the proper position, simply reissue <Ctrl-x><Ctrl-x> to swap them back.
Previous | Table of Contents | Next |