SESSION 2 HOMEWORK
15 QUESTIONS ABOUT vi BASED ON READING 179 - 233 (vi-quick notes
- How do you switch between command mode and insert mode?
- In command mode,
what does Ctrl-u do? Ctrl-d?
what is the difference between w and W, and between b and B?
what does $ do? How about zero (0)?
what does o do? Which mode does it end up in?
- In insert mode,
what does each of the following do:
- How do you exit vi without altering the file you have open?
- How do you delete the current line?
- Suppose you delete a line; can you somehow reverse that operation?
- Suppose you wrote your first name, but forgot to capitalize the first letter. How can
you capitalize one character? What is the name of that funny character and where is it
located on your keyboard?
- What is the quickest way to navigate to the last line of a file? How about to the top of
- How do you search for the word "fuzzy" in a file?
- Suppose the word "fuzzy" were on lines 3 and 9 of the file, and your cursor is
one line 8. When you search for fuzzy, will go to line 3 or line 9?
- Suppose you wanted to play if very safe and NEVER alter any file that you view with vi.
What alias could you us to the vi command to make it so that vi never modifies the files
- Suppose you work for General Motors and have to add your name, Quarkson, to the list of
employees in the Technical Publications Department. How can you start vi at that portion
of the huge Employees file that deals with Technical Publications. (Hint: what
"regular expression" can give as an "argument" when you open vi? What
two characters precede the "string" of your argument?)
- What command lets to substitute one character for another at the place where the cursor
- The readme.txt file for Product Whizbang that you are working on has the word Whizbang
many times. Marketing just decided to change the product name to SuperWhizbang. Using vi,
how can you quickly replace all the occurences of "Whizbang" with
"SuperWhizbang" (and thereby become a hero)?
- What command would you "feed" vi to change "Whizbang" with
"SuperWhizbang" only for the first 250 lines of the readme.txt file?
Happy Hacking. Please email your work and any questions to talbert@WORDesign.com
Thank you and see you Thursday.
copyleft 1999 Thomas Albert