home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / editor / tvx_edit.arc / TVX_TUT.DOC < prev    next >
Text File  |  1986-03-17  |  22KB  |  410 lines

  1.  
  2.  
  3.         ****************************************************************
  4.         *                                                              *
  5.         *                 TVX Interactive Introductions                *
  6.         *                                                              *
  7.         ****************************************************************
  8.  
  9.                                   **** 1 ****
  10.  
  11.      This is a demonstration of the capabilities of TVX.  Commands to TVX
  12. consist of single key mnemonic commands.  TVX is what is known as a two mode
  13. editor - command mode and insert mode.  TVX is normally in command mode, and
  14. keystrokes are interpreted as commands like 'up', 'down', 'find', etc.  When
  15. you enter an 'i' for insert, TVX enters insert mode which allows you to enter
  16. text into the file.  For this lesson, you will be requested to enter commands.
  17. Each command key you are to enter will be enclosed in 'single quotes'.  Thus, a
  18. request to enter 'd' means that you should simply hit the 'd' key on the
  19. keyboard.  Each time you hit the 'd' key, the blinking cursor will move down
  20. one line.  NOW, hit the 'd' key repeatedly until '**** 2 ****' and part 2 of
  21. this demo shows on the screen.  (You will have to hit the 'd' key around 20
  22. times.) Do that NOW. 
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                                   **** 2 ****
  30.      Welcome to part two of the lesson.  Continue to hit the 'd' key until the
  31. '**** 2 ****' is at the very top of the screen. 
  32.      TVX was written by Dr. Bruce Wampler, and has been released to the public
  33. domain.  It has versions running on CP/M-80, the IBM-PC, generic MS-DOS, the
  34. Atari 520ST, and several versions of Unix.  If you read the instructions and
  35. enter the commands when requested, you should get a good demonstration of the
  36. power of TVX.  This lesson is organized into several sections.  Each section
  37. will start with a line in the form '**** 1 ****'. 
  38.      Most of the commands to TVX have been chosen to be mnemonic - thus it is
  39. 'd' for down, 'u' for up, 'l' for left, and 'r' for right.  Pressing any of
  40. those four keys now will allow you to move the cursor around the screen.  The
  41. 'd' and 'u' commands will move the cursor to the beginning of the next or
  42. previous lines. 
  43.  
  44. NOW, hit the four cursor movement keys needed and position the blinking cursor
  45. at the beginning of this line.  Whenever we get to a new section, use the 'd'
  46. command to get the '**** n ****' at the top of the screen. 
  47.      TVX is easy to use.  Already, you can move around the file and see what is
  48. going on.  This demo file is actually a text file, just like one you might edit
  49. using TVX.  There are other commands to move the cursor around.  The 'p' (page)
  50. command moves down 25 lines at a time, which is a new screenful.  Right now,
  51. the cursor should still the line indicated above.  If you NOW hit 'p', part 3
  52. will show up. 
  53.  
  54. ....  end of part 2 .... 
  55.  
  56.  
  57.  
  58.  
  59.  
  60.                                   **** 3 ****
  61.      Welcome to section 3. As before, repeatedly hit the 'p' key to position
  62. the **** 3 **** at the top of the screen. 
  63.      We will now be entering some other TVX commands.  When you are requested
  64. to enter a command, the entire sequence will be enclosed in double quotes:
  65. "cmds".  Remember that commands are mnemonic - one key will enter one command
  66. to the editor.  Sometimes entering a command will cause the screen to be
  67. updated, or a message to be printed at the bottom.  Usually, that is normal.  A
  68. major benefit of a screen editor is "what you see is what you get". 
  69.      Most of the commands to TVX take optional count arguments.  To enter a
  70. count to a command, you enter the count using the digit keys on the top row of
  71. the keyboard, followed by the command key.  Thus, entering the sequence "10d"
  72. would cause the cursor to go down 10 lines.  Counts may be negative, too.  If
  73. you entered "-1p" (or, equivalently, "-p"), the cursor would move UP one
  74. screenful of text.  This convention for entering counts holds true for all TVX
  75. commands that take count arguments.  You may want to try using 'p' or "10d" or
  76. other count instead of repeatedly hitting the 'd' key alone to move around this
  77. lesson. 
  78.      As you use more and more TVX commands, it will be useful to have the quick
  79. reference chart on hand.  Don't enter any other commands before requested.
  80. This lesson is not foolproof, either.  If you try to get out of sequence of the
  81. lesson, then you will likely get lost. 
  82. (*** Important note for users with limited RAM.  This entire lesson may not fit
  83. into memory at once!  When you get to the point that no more text will scroll
  84. up from the bottom, you must hit '^W'.  Pressing both the 'Ctrl' and the 'w'
  85. keys at the same time will cause the next part of the lesson to be read in.)
  86. NOW, hit 'd' (or a 'p') until **** 4 **** is at the screen top. 
  87.  
  88. ....  end of part 3 .... 
  89.  
  90.  
  91.  
  92.  
  93.  
  94.                                   **** 4 ****
  95.      We will now actually edit some text.  NOTE: This IS a scratch file, so
  96. don't worry about changing it.  The 'k' (for kill a character) command can be
  97. used to delete a single character at a time.  By hitting the 'k' key once, the
  98. character the cursor is positioned on will be deleted.  A "5k" would delete the
  99. next 5 characters.  NOW, use the four cursor motion commands to position the
  100. cursor on the following sharp: #. We will delete this text.  After the cursor
  101. is on the #, repeatedly hit the 'k' key and delete only the sentence
  102. immediately following the #.
  103.      We will continue with simple editing of text.  If at any time, the text is
  104. off the bottom of the screen, use the 'd' down key to move down and scroll the
  105. new text onto the screen as needed. 
  106.      The backspace key may be used to delete one character at a time before the
  107. cursor.  NOW, position the cursor over the '0' in the following string:
  108. 1234567890abcd.  NOW, use the backspace key to delete the digits before the
  109. '0'.  If you had used 'k' instead, the characters AFTER the '0' would have been
  110. deleted.  That's all there is to deleting text. 
  111.      Suppose you want to delete an entire line.  The '^k' key (pressing the
  112. 'Ctrl' key and the 'k' key at the same time, from now on, '^x' means Control-X)
  113. will delete the entire line that the cursor is currently positioned on.  NOW,
  114. position the cursor anywhere on the next line. 
  115. ---- We will delete this entire line ----
  116. NOW, with the cursor on the previous line, when you hit '^k', it will be
  117. deleted.  Of course, you can use a count argument and delete several lines,
  118. forwards or backwards.  Remember that counts are entered using the by entering
  119. a count before the command key.  NOW, position the cursor on the next line. 
  120. We will now delete 5 lines.  NOW, enter the command sequence "5^k". 
  121. This is line 2 to be killed. 
  122. Line 3
  123. Line 4
  124. Line 5
  125.  
  126.      Those 5 lines should now be gone. 
  127.  
  128.      What if you accidentally kill a line?  You can get it back! 
  129. NOW, position the cursor on this line and hit '^k'. 
  130. It's gone.  NOW, before you enter any other commands, press '^g' (for get
  131. back).  That line is back!  This works only for the last killed line, however.
  132. If you had entered "5^k", then only the last line would have been recovered.
  133. The last line killed will be saved until another line is killed. 
  134.      Two other useful commands are available for deleting text.  You may want
  135. to delete the rest of a given line, or you may want to delete the first part of
  136. the line.  NOW, position the cursor over the c on the next line:
  137. 1234567890abcdef
  138. If you now hit '"' key (double quote), the part of the line from the 'c'
  139. onwards will be deleted.  Now move the cursor back to the '0'on that line.  To
  140. delete the first part of the line, use ''' (single quote).  You should now have
  141. '0ab' on that line, since the ''' does not include the character the cursor is
  142. on.  The '^G' unkill command works for ''' and '"', just like '^k'. 
  143.      NOW, move the cursor down and get part 5 (**** 5 ****) to the top of the
  144. screen.  You can use 'p' or 'd'. 
  145.  
  146. ....  end of part 4 .... 
  147.  
  148.  
  149.  
  150.                                   **** 5 ****
  151.      We will now insert some text.  To insert text, you first position the
  152. cursor to the place you want to insert the text.  Then enter the 'i' (for
  153. insert) to enter insert mode, then enter the text you want to insert using the
  154. regular keyboard keys.  Notice that the message '### Insert Mode ###' appears
  155. on the bottom of the screen.  On some versions, the shape of the cursor will
  156. change, too.  As you type, the text you enter will appear on the screen in
  157. front of the cursor: "what you see is what you get".  As you continue, all
  158. characters that you type will continue to be inserted.  When you are done
  159. inserting text, press the 'Esc' key.  You will now be back in command mode. 
  160.      NOW, let's try to insert something.  How about your name.  Position the
  161. cursor over the period (.) on the next line:
  162. My name is: .
  163. NOW, press 'i' to enter insert mode, then type your name, and finally press
  164. 'Esc' to return to command mode.  That is all there is to inserting text.  TVX
  165. is a line oriented editor, which is most useful for entering programs.  You
  166. press the 'Return' key to end a line and begin a new one. 
  167.      Sometimes you may want to insert a block of text in the middle of a line,
  168. or before some existing text.  You can simply enter the text, but the constant
  169. shifting of text to the right can be visually unpleasant.  The 'o' (open)
  170. command will open a new line for inserting text.  Try it. 
  171.      The next section covers the find pattern command will show you how to
  172. search for text and find the section or line of the file you want to edit. 
  173.  
  174. ....  end of part 5 .... 
  175.  
  176.  
  177.  
  178.  
  179.                                   **** 6 ****
  180.      It is often useful to be able to find a particular word or pattern in the
  181. text file.  The TVX find command may be used for this.  To start the find
  182. command, you first press the 'f' (find) key.  This will cause the message
  183. "Find?" to be printed on the bottom of the screen.  You then enter the pattern
  184. you want to find.  The pattern is terminated with an [Esc].  If the pattern is
  185. found, the screen will be updated, and the cursor placed after the pattern.  If
  186. the pattern is not found, the cursor is not changed and "Not found" will be
  187. printed on the bottom.  When entering the pattern, you may use the backspace
  188. key to edit your input.  Each time you hit the backspace key, one character is
  189. deleted. 
  190.      NOW, let's search for the pattern "replace".  To do this, first hit the
  191. 'f' command, followed by "replace[Esc]".  The cursor will now be placed after
  192. the next occurrence of "replace".  If you had supplied a count of -1 (or -)
  193. before the 'f', then the search would have been for the first previous
  194. occurrence of "replace". 
  195.      If you now hit the ';' (find again) key, the next occurrence of the last
  196. pattern you found, here "replace", will be found.  TVX always remembers the
  197. last pattern you found, and the ';' command will search again. 
  198.      Speaking of replace, TVX makes it easy to find a pattern and then either
  199. delete that string or replace it with a new string.  If you hit the '/' (delete
  200. last) key immediately after finding a pattern, that pattern will be deleted.
  201. Try another ';' to find 'replace' again, and then hit '/'.  If you want to then
  202. replace the text, you can use the '=' command.  It is just like entering "/i". 
  203.      Normally, the find pattern command ignores upper and lower case.  You can
  204. search for the exact case, however.  You may also search for arbitrary
  205. patterns.  See the user's manual for details. 
  206.  
  207.  
  208. ....  end of part 6 .... 
  209.  
  210.  
  211.  
  212.  
  213.                                   **** 7 ****
  214.      This section covers more cursor movement commands.  So far, we have only
  215. used the four cursor motion keys and the 'p' commands.  Two commands let you
  216. skip over a word at a time.  These are the 'TAB' and '{' (or '[') commands.
  217. Thus, the 'TAB' key will skip over the next word to the right.  The '{' skips
  218. over words backwards.  Try using those two commands to see how they work. 
  219.      The '.' (period, usually the same key as '>') command will move the cursor
  220. to the end of the current line.  The ',' (comma, on the same key as '<')
  221. command moves the cursor to the beginning of the line.  Experiment with those
  222. two commands. 
  223.      You may have noticed that the 'u' and 'd' commands always move the cursor
  224. to the beginning of the line.  Two commands will move the cursor vertically,
  225. but keep it in the same column.  The '^d' key moves down in the same column,
  226. and the '^u' command moves up in the same column.  Try using 'u', 'd', '^u',
  227. and '^d' to see the difference in their operation. 
  228.      The 'p' command moves up and down (with a - count) a screenful.  The 'h'
  229. command keys will move the cursor a half screenful at a time. 
  230.      You also can get to the very beginning or the very end of the file.  These
  231. commands are 'b' (begin) and 'e' (end).  Whenever you enter a command that
  232. moves the cursor a long ways, TVX remembers where you came from.  Immediately
  233. after entering a command that changes the cursor location, you can use the 'j'
  234. (jump back) command to return the cursor to the previous location.  For
  235. example, if you enter 'b' followed by a 'j', you will move to the beginning,
  236. then jump back to here.  The 'j' is most useful after the begin and end
  237. commands, as well as after a 'f' find command. 
  238.  
  239.  
  240. ....  end of part 7 .... 
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.                                   **** 8 ****
  248.      We will now cover some of the more advanced features of TVX, such as
  249. moving blocks of text and entering editing macros.  TVX can be used to easily
  250. move text around a file.  First, lets move a copy of the following three lines
  251. down a ways.  Use 'd' to place the cursor at the beginning of the following
  252. three lines. 
  253. Saved line 1 Saved line 2 Saved line 3
  254. NOW, hit the 's' (for save) command three times (or "3s").  Note that the
  255. cursor moved down three lines and is now positioned over the NOW.  We will make
  256. a copy of those lines below here.  Place the cursor over the # on the next
  257. line. 
  258. # The saved text will get copied above this line
  259. If you now hit the 'g' (get) command, a copy of the three saved lines will get
  260. inserted right before the # line.  These commands are called 'Save line' and
  261. 'Get back saved text'. 
  262.      Remember the '/' delete pattern command used on 'f' find?  That command
  263. really is "delete last thing", where the last "thing" can be a find pattern as
  264. before, or the text just saved in the save buffer, or the text just gotten from
  265. the save buffer.  Now we can easily move several lines of text.  Save the
  266. following two lines by positioning the cursor at the beginning of the first and
  267. then hitting 's' twice. 
  268. Move this line 1 Move this line 2
  269. Now the cursor will be at the beginning of this line.  If you now hit the '/'
  270. key, those two lines will be deleted.  Move them to the following line by
  271. positioning the cursor and hitting the 'g' to get them back. 
  272. Move them to in front of this line. 
  273.      Each time you hit the 's' key, another line is saved in the save buffer.
  274. If you don't enter any other commands between consecutive 's' commands (or 's'
  275. with counts) continue to add text to the save buffer.  The first 's' command
  276. entered following any other command will first clear whatever text might
  277. already be in the save buffer. 
  278.      If you want to save a few lines from one part of the file, then a few more
  279. from a different place, you can use the 'a' append command.  Append is very
  280. much like the save command except that it always adds on to the end of the save
  281. buffer and will not clear it if there are other commands between. 
  282.      A few more words about the '/' delete last thing command.  So far you have
  283. seen how '/' works with the 'find' and 'save' commands.  It also works right
  284. after a 'g' get command, so if you get text to the wrong place, you simply need
  285. to hit '/' to delete it again.  '/' also works right after the 'TAB' and '{'
  286. commands, which makes it easy to delete words.  If you entered "5[TAB]"
  287. followed by a '/', the cursor would skip over 5 words and then those 5 words
  288. would be deleted.  You may try that here if you wish to see it work. 
  289.  
  290.  
  291.  
  292. ....  end of part 8 .... 
  293.  
  294.  
  295.  
  296.                                   **** 9 ****
  297.      This section demonstrates the use of the repeat buffer.  The repeat buffer
  298. allows you to enter one or several commands and cause them to be repeatedly
  299. executed.  For example, suppose you wanted to change the next 3 occurrences of
  300. 'abc' to 'wxyz'.  Using the 'f' find and '/' delete last (or even '=' delete
  301. last and insert) commands to do this manually can be time consuming.  It would
  302. be difficult to do this if there were 100 changes to make.  The repeat loop
  303. solves this problem.  To do the example one time, you might enter the
  304. following: "fabc[Esc]=wxyz[Esc]".  (Note that [Esc] means the Escape key, and
  305. will be echoed on the bottom of the screen as a '$'.) We will now do this three
  306. times.  FIRST, position at the beginning of the next line. 
  307. The cursor should be at the beginning of this line.  Now, enter a '3' followed
  308. by the '<' (begin loop) key.  That will cause the message "repeat: 3<" to be
  309. printed on the bottom line.  Now, enter the above command:
  310. "fabc[Esc]=wxyz[Esc]".  That is the body of the repeat loop.  To change the
  311. next 3 abc's (abc), now terminate the loop by entering ">[Esc][Esc]".  The '>'
  312. (upper case comma key) closes the loop, and the double [Esc] is necessary to
  313. terminate the loop.  Note that the [Esc] echoes as '$'.  Now, the next three
  314. occurrences of abc will have been changed to 'wxyz'.  If there had been less
  315. than three occurrences of 'abc', then the loop would have terminated early with
  316. an error message.  You may use the backspace key to edit your input to the
  317. repeat command, just as with find. 
  318.      Now suppose you want to change the next 'abc' into 'wxyz'.  TVX remembers
  319. the loop you just entered.  (Actually, there are 3 to 9 different repeat loops
  320. which can be displayed by entering the '?' help command.) Now, to change one
  321. more 'abc', press the '&' key.  The 'Rpt agn' command will cause the loop to be
  322. re-executed count times. 
  323.      These repeats can get quite complex.  This can be a danger, but is a
  324. powerful tool.  Any of the 3 to 9 repeat loop buffers can be selected and used
  325. to hold TVX command macros.  The Reference Manual explains how to use the
  326. multiple repeat buffers.  By doing nothing, however, you still get the one
  327. default repeat loop with no extra worry or action on your part. 
  328.  
  329.  
  330.  
  331. ....  end of part 9 .... 
  332.  
  333.  
  334.  
  335.  
  336.  
  337.                                  **** 10 ****
  338.      There is one command that you may find useful occasionally (at least on
  339. single user systems such as an IBM-PC): screen print.  The '^p' command will
  340. cause the current screen to be sent to the printer (if there is one!).  By
  341. consecutively hitting '^p', 'p', ..., you can print as much of your file as you
  342. wish.  You can try that now if you have a printer and it is ready. 
  343.  
  344.  
  345.  
  346.  
  347.  
  348. ....  end of part 10 .... 
  349.  
  350.  
  351.  
  352.  
  353.  
  354.                                  **** 11 ****
  355.      TVX has one other major feature that may occasionally be useful to you.
  356. You can read in an external file into the save buffer.  The 'g' get command can
  357. then be used to insert that text into the file you are editing.  To use this
  358. command, press '^y' (for yank).  You will be asked for the name of a file.
  359. That file will be read in.  If you now position the cursor and press 'g', the
  360. contents of that file will be placed in the current buffer. 
  361.      The opposite of '^y' is "-^y".  You can save a portion of the current file
  362. in another one.  Save the section you want to write in the save buffer using
  363. the 's' command, then enter "-^y".  You will be asked for the name of the file
  364. to write to.  The current contents of the save buffer will then be saved in
  365. that file. 
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.                                  **** 12 ****
  376.      TVX has several features that improve its interaction with nroff type text
  377. formatters.  (These formatters typically have formatting commands that begin
  378. with a period in column one of the line.) One is the auto-wrap feature.  With
  379. the feature, TVX will automatically wrap around when you pass a specified
  380. column when entering text.  To turn on auto-wrap, enter the command "70:w".
  381. The 70 means wrapping will occur when you enter the first space after column
  382. 79.  The ':' is a general 'set' command used to set various parameters to TVX. 
  383.  
  384. When you use auto-wrap, you will get source text with a generally even
  385. appearance.  However, as you edit text, you will find the
  386. lines getting uneven, just like this text. The "tidy" command can be
  387. used to even out these lines.  Move the cursor
  388. to the beginning of this text, and enter "8t". Each
  389. 't' will tidy one line.  Tidy works very much like a formatter's filling,
  390. and knows about dot commands.  It also won't tidy lines beginning
  391. with a blank or tab.
  392.  
  393.  
  394.  
  395.  
  396.  
  397.                                 **** last ****
  398.      TVX has several other features and commands.  These are described in
  399. detail in the TVX reference manual.  This lesson has tried to give examples of
  400. some of the more commonly used features of TVX. 
  401.      Feel free to experiment on this lesson file with all the commands provided
  402. by TVX.  The best way to learn about the operation of TVX is by using it.  You
  403. are on your own now.  When you are done, you can exit TVX with the '^X' exit
  404. command.  You should have a good idea of the philosophy of TVX now, and can
  405. read the user's manual with new insight. 
  406.  
  407.  
  408. Remember - '^x' to exit, 'b' for beginning, 'e' for end
  409.  
  410.