Answers to Lab 2: Learning the vim editor.

The answers are in parenthesis, in bold, after the question. Also, in the syntax :%s/old/new/g, the percent sign (%) is equivalent to 1,$ (as in your notes).

  1. Download (save link/page ) the file vi_practice file to your home directory.
  2. Open this file in the vim (vi) editor.
  3. (1 point) Practice cursor movement commands:
  4. (1 point) Practice editing commands:
  5. (1 point) Practice search and replace commands:
  6. Save the file and quit vi, which returns you to the shell prompt.
    (:wq)
  7. Download vi_practice_edited Make sure you did everything correctly by typing the command 
            diff vi_practice vi_practice_edited
    This command looks for any differences in the contents of the two files. If you get no output from this command, you've done everything correctly.  You can also compare the two files next to each other by typing
            diff -y vi_practice vi_practice_edited
  8. Now we're going to edit another text file - this time a PDB file that describes a real protein. Right click on this link and choose "Save link as... Or Save to disk...". Save the file in your home directory. Now open another unix shell and create a file named lab2_my_answers in your home directory. You will put your answers to questions Q1, Q2 and Q3 (below) in it, each answer on its own line. Eaxmple: Q1: Bla-bla-bla ...
    (if vim complains about the file being funny, don't worry.)
  9. Open the file in the vi editor, and make the following changes: