Aucf-cs.336 net.games utcsrgv!utzoo!decvax!duke!ucf-cs!whm Tue Jan 26 01:29:01 1982 Vi Short Answer Quiz This article doesn't talk about a game, but rather presents a short quiz to test your knowledge of the Vi text editor. ----------------------------------------------------------------------- The Vi Short Answer Quiz by Bill Mitchell Answer all of the following questions in terms of keystrokes from the screen mode of Vi. Use notation such as , , ^X, etc. for special characters. "Shifts" do not count as keystrokes, i.e. B and b are each one keystroke, control characters are also one keystroke. Use common sense in answering each question, no questions are intended to be tricky. The goal is to use as few keystrokes as possible. Make no assumptions about where you are positioned in the file other than what is given in the question. This test was written for Ex 3.6 under 4.1bsd, so if you don't have that, you might have some rather gruesome answers for some questions. Assume the editor is configured as it is at startup without an .exrc file. The quiz can be done using only two different commands from the command mode (initiated by typing :), but you may do as much in command mode as you like. Feel free to use any references you wish. Remember, EVERY keystroke counts, returns and escapes included. (1) Move to the fifth line of the file. (2) Append the current line to the end of the previous line. (3) Delete all of the current line that is not to the left of the cursor. (4) You are editing a document and are positioned on the first character of a sentence. Delete the next five sentences. (5) I'm sorry, get those last five sentences back where they were. (6) I just can't make my mind up, get rid of those same five sentences. (7) Change the next sentence to the single character "?". (8) You are positioned on the y in "((x*3)-(y-(1*2*3(((())))))x*(i+(j*k))*z)", make it read: "((x*3)-x**z)". (9) Move the next five lines to before the current line, retain the order of the five lines. (10) Delete characters 30 through 40 in the current line. Assume that there are more than 40 characters in the current line. (11) Move all of the text that is visible on the screen to the end of the file. (12) The next line in the file is: "x = x + 1;", change it to: "/*x = x + 1;*/". (13) Find out what line you are on. (14) Delete the next line in the file that contains the word "the" and then delete the line that you were on before you went looking for "the". (15) Starting with the current line, move the next ten lines 12 spaces to the right. You may insert tabs if you wish. (16) Make the sentence "The machine, described in [Smith 80], was a complete failure." read "The machine was a complete failure." Assume you are on the "T". (17) Insert three backspaces after the last character of the current line. (18) Change every instance of a digit, n, on the current screen, to (n+1) mod 10, that is, 0's to 1's, 1's to 2's, ... 9's to 0's. (Hint: This might be done using something in addition to the editor, but the editor is involved.) (19) Change the string "hello" to "HELLO". Assume you are positioned on the "h". (20) You have just finished making 300 changes in the current line in an as yet unsuccessful attempt to correct a one word spelling error. Make the line appear as it did before you went to work. Scoring: Count the total number of keystrokes that you think it will take. If your total is: 200 .................Average > 250 .................Do you seem to spend a lot of time editing? > 300 .................Get yourself some documentation. > 500 .................Have you ever used Vi? As mentioned above, if you can do this in less than 150 keystrokes, mail your answers to me (duke!ucf-cs!whm). If I get many responses, I'll collect them and announce an overall winner in a couple of weeks. Note: If you don't have Ex 3.6 under 4.1bsd, tell me which version of Vi you are assuming you have. ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.