Consider the following scenario: You start vim to edit an existing file. You make many changes to the file and then realize that you deleted a critical section of the file early in your editing session. You want to get that section back but do not want to lose all the other changes you made. What would you do?

What will be an ideal response?


This problem assumes that you have not written out the Work buffer since
you deleted the critical section. There are a few ways to approach this prob-
lem. To be safe, make copies of the Work buffer and the original file under
names other than the name of the original file. If you then make a mistake,
you can easily start over. For example, give the command :wq changedfile
to save the Work buffer as changedfile and exit from vim. Then use cp to
copy the original file to, for example, file.orig and to copy changedfile to
changedfile.orig. Start vim with the following command, which instructs it
to edit the original file first and the modified file second:
$ vim originalfile changedfile
Once you are editing the original file, search for and copy the part of the
file you want to save into the General-Purpose buffer or a Named buffer.
For example, to save five lines, starting with the current line, into the
Named buffer a, give the command "a5yy. Then edit the modified file by
giving the command :n!RETURN (edit the next file without writing out the
Work buffer). Position the cursor where you want to insert the text and give
the command "ap or "aP, depending on where you want to place the copied
text.

Computer Science & Information Technology

You might also like to view...

Composition indicates a/an _______________ relationship.

a. Is-a b. Has-a c. both A & B d. none of the above

Computer Science & Information Technology

Borders and background colors define areas of a worksheet and call attention to important information.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

IaaS, PaaS, and SaaS use different types of cloud infrastructures. These infrastructures offer different levels of security, resource restrictions, and management. These are the most notable what?

What will be an ideal response?

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. Insertion into a vector runtime is O(1) at any position in the vector. Explain what ‘runtime is O(1)’ means. 2. Insertion into an STL list takes O(1) time at any position in the list. What does ‘ takes O(1) time’ mean? 3. STL ranges [first, last) are always ‘half-open’ – from the first element to a designation for one past the last element. 4. Given a map m, the expression m["value"] will return NULL if there is no string named "value" stored in the map. 5. Elements of a set and map are stored in sorted order.

Computer Science & Information Technology