Exercises

 < Day Day Up > 

1.

Given a buffer full of English text, answer the following questions:

  1. How would you change every instance of his to hers?

  2. How would you do this only in the final paragraph?

  3. Is there a way to look at every usage in context before changing it?

  4. How would you deal with the possibility that His might begin a sentence?

2.

Which command moves the cursor to the end of the current paragraph? Can you use this command to skip through the buffer in one-paragraph steps?

3.

Suppose that you get lost in the middle of typing a long sentence.

  1. Is there an easy way to kill the botched sentence and start over?

  2. What if only one word is incorrect? Is there an alternative to backspacing one letter at a time?

4.

After you have been working on a paragraph for a while, most likely some lines will have become too short and others too long. Is there a command to "neaten up" the paragraph without rebreaking all the lines by hand?

5.

Is there a way to change the entire contents of the buffer to capital letters? Can you think of a way to change just one paragraph?

6.

How would you reverse the order of two paragraphs?

7.

How would you reverse two words?

8.

Imagine that you saw a Usenet posting with something particularly funny in it and saved the posting to a file. How would you incorporate this file into your own buffer? What if you wanted only a couple of paragraphs? How would you add > to the beginning of each included line?

9.

On the keyboard alone emacs has always offered a full set of editing possibilities. Generally several techniques will accomplish the same goal for any editing task. In the X environment the choice is enlarged still further with a new group of mouse-oriented visual alternatives. From these options you must select the way that you like to solve a given editing puzzle best.

Consider this Shakespearean fragment:

 1. Full fathom five thy father lies; 2.   Of his bones are coral made; 3. Those are pearls that were his eyes: 4.   Nothing of him that doth fade, 5. But doth suffer a sea-change 6. Into something rich and strange. 7. Sea-nymphs hourly ring his knell: 8.           Ding-dong. 9. Hark! now I hear them-- 10.      Ding-dong, bell! 

The following fragment has been typed with some errors:

 1. Full fathiom five tyy father lies; 2. These are pearls that were his eyes: 3.   Of his bones are coral made; 4.   Nothin of him that doth fade, 5. But doth susffer a sea-change 6. Into something rich and strange. 7. Sea-nymphs hourly ring his knell: 8.           Ding=dong. 9. Hard! now I hear them-- 10.      Ding-dong, bell! 

Use only the keyboard to answer the following:

  1. How many ways can you think of to move the cursor to the spelling errors?

  2. Once the cursor is on or near the errors, how many ways can you think of to fix them?

  3. Are there ways to fix errors without explicitly navigating to/searching for them? How many can you think of?

  4. Lines 2 and 3 are transposed. How many ways can you think of to correct this situation?

     < Day Day Up > 


    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    ISBN: 131478230
    EAN: N/A
    Year: 2005
    Pages: 213

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