Lab meeting: Learning the vim editor

If you arrive before lab begins, feel free to log on, work on assignments, or begin the lab work.

This week we will be using the vim editor in addition to the commands we have already learned. On most modern unix machines vim and vi are the same thing. If you have questions about vim, you can look it up in your book or follow the links from the class site. If you cannot remember what a command does, try 'man <command>'.  Also, there is a tutorial on fundamental and advanced vi at the University of Washington that you can reference.

List of Tasks

  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.
  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 ...
  9. Open the file in the vi editor, and make the following changes:


When you have finished editing the PDB and the answer files, call your instructor.