home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / STEVIE2.ZIP / STEVIE.DOC next >
Text File  |  1988-06-09  |  16KB  |  510 lines

  1.  
  2.              STEVIE - An Aspiring VI Clone
  3.  
  4.                  User Reference
  5.  
  6.                   Tony Andrews
  7.  
  8.                   3/6/88
  9.  
  10.  
  11. Overview
  12. --------
  13.  
  14. STEVIE is an editor designed to mimic the interface of the UNIX editor
  15. 'vi'. The name (ST Editor for VI Enthusiasts) is due to the fact that
  16. the editor was first written for the Atari ST. The current version has
  17. been ported to UNIX and OS/2, but I've left the name intact for now.
  18.  
  19. I've labelled STEVIE an 'aspiring' vi clone as a warning to those who
  20. may expect too much. On the whole, the editor is pretty complete. Almost
  21. all of the visual mode commands are supported. The biggest failing at the
  22. moment is that the undo command is currently in a state of disrepair.
  23. Recent enhancements in other areas have required the undo command to be
  24. mostly disabled until it can catch up with the other changes. But don't be
  25. discouraged. I've tried very hard to capture the 'feel' of vi by getting
  26. the little things right. Making lines wrap correctly, supporting true
  27. operators, and even getting the cursor to land on the right place for
  28. tabs are all a real pain, but do much to make the editor feel right.
  29.  
  30. This program is the result of many late nights of hacking over the last
  31. several months. The first version was written by Tim Thompson and posted
  32. to USENET. From there, I reworked the data structures completely, added
  33. LOTS of features, and generally improved the overall performance in the
  34. process.
  35.  
  36. STEVIE may be freely distributed. The source isn't copyrighted or
  37. restricted in any way. If you pass the program along, please include all
  38. the documentation and, if practical, the source as well. I'm not fanatical
  39. about this, but I tried to make STEVIE fairly portable and that doesn't
  40. do any good if the source isn't available.
  41.  
  42. The remainder of this document describes the operation of the editor.
  43. This is intended as a reference for users already familiar with the real
  44. vi editor.
  45.  
  46.  
  47. Starting the Editor
  48. -------------------
  49.  
  50. The following command line forms are supported:
  51.  
  52.     vi [file ...]        Edit the specified file(s)
  53.  
  54.     vi -t tag        Start at location of the given tag
  55.  
  56.     vi + file        Edit file starting at end
  57.  
  58.     vi +n file        Edit file starting a line number 'n'
  59.  
  60.     vi +/pat file        Edit file starting at pattern 'pat'
  61.  
  62. If multiple files are given on the command line (using the first form),
  63. the ":n" command goes to the next file, ":p" goes backward in the list,
  64. and ":rew" can be used to rewind back to the start of the file list.
  65.  
  66.  
  67. Set Command Options
  68. -------------------
  69.  
  70. The ":set" command works as usual to set parameters. Each parameter has
  71. a long and an abbreviated name, either of which may be used. Boolean
  72. parameters are set as in:
  73.  
  74.     set showmatch
  75.  
  76. or cleared by:
  77.  
  78.     set noshowmatch
  79.  
  80. Numeric parameters are set as in:
  81.  
  82.     set scroll=5
  83.  
  84. Several parameters may be set with a single command:
  85.  
  86.     set novb sm report=1
  87.  
  88. To see the status of all parameters use ":set all". Typing ":set" with
  89. no arguments will show only those parameters that have been changed.
  90. The supported parameters, their names, defaults, and descriptions are
  91. shown below:
  92.  
  93. Full Name    Short    Default        Description
  94. ------------------------------------------------------------------------------
  95. vbell        vb    vb        Use visual bell (novb for audible bell)
  96. showmatch    sm    nosm        Showmatch mode
  97. wrapscan    ws    ws        Wrapscan (searches cross file start/end)
  98. errorbells    eb    noeb        Ring bell when error messages are shown
  99. showmode    mo    nomo        Show on status line when in insert mode
  100. backup        bk    nobk        Leave backup in *.bak on file writes
  101. return        cr    cr        End lines with cr-lf when writing
  102. list        list    nolist        Show tabs and newlines graphically
  103.  
  104. scroll        scroll    12        Number of lines to scroll for ^D and ^U
  105. tabstop        ts    8        Number of spaces in a tab
  106. report        report    5        Min # of lines to report operations on
  107. lines        lines    25        Number of lines on the screen
  108.  
  109.  
  110. The EXINIT environment variable can be used to modify the default values
  111. on startup as in:
  112.  
  113.         setenv EXINIT="set sm ts=4"
  114.  
  115. The 'backup' parameter, if set, causes the editor to retain a backup of any
  116. files that are written. During file writes, a backup is always kept for
  117. safety until the write is completed. At that point, the 'backup' parameter
  118. determines whether the backup file is deleted.
  119.  
  120. In environments (e.g. OS/2 or TOS) where lines are normally terminated by
  121. CR-LF, the 'return' parameter allows files to be written with only a LF
  122. terminator (if the parameter is cleared).
  123.  
  124. The 'lines' parameter tells the editor how many lines there are on the screen.
  125. This is useful on systems like the ST where various screen resolutions may be
  126. used. By using the 'lines' parameter, different screen sizes can be easily
  127. handled.
  128.  
  129.  
  130. File Manipulation Commands
  131. --------------------------
  132.  
  133. The following table shows the supported file manipulation commands as
  134. well as some other 'ex' commands that aren't described elsewhere:
  135.  
  136. :w        write the current file
  137. :wq        write and quit
  138. :x        write (if necessary) and quit
  139. ZZ        same as ":x"
  140.  
  141. :e file        edit the named file
  142. :e!        re-edit the current file, discarding any changes
  143. :e #        edit the alternate file
  144.  
  145. :w file        write the buffer to the named file
  146. :x,y w file    write lines x through y to the named file
  147. :r file        read the named file into the buffer
  148.  
  149. :n        edit the next file
  150. :p        edit the previous file
  151. :rew        rewind the file list
  152.  
  153. :f        show the current file name
  154. :f name        change the current file name
  155.  
  156. :ta tag        go to the named tag
  157. ^]        like ":ta" using the current word as the tag
  158.  
  159. :help        display a command summary
  160.  
  161. The ":help" command can also be invoke with the <HELP> key on the Atari
  162. ST. This actually displays a pretty complete summary of the real vi with
  163. unsupported features indicated appropriately.
  164.  
  165. The commands above work pretty much like they do in 'vi'. Most of the
  166. commands support a '!' suffix (if appropriate) to discard any pending
  167. changes.
  168.  
  169. When writing just part of the buffer, the following address forms are
  170. supported:
  171.  
  172.         addr [+- number]
  173.  
  174. where 'addr' may be one of the following:
  175.  
  176.         a line number
  177.         a mark (as in 'a or 'b)
  178.         '.' (the current line)
  179.         '$' (the last line)
  180.  
  181.  
  182. String Searches
  183. ---------------
  184.  
  185. String searches are supported, as in vi, accepting the usual regular
  186. expression syntax. This was done using Henry Spencer's regular expression
  187. library without modification. I added code outside the library to support
  188. the '\<' and '\>' extensions. This actually turned out to be pretty easy.
  189.  
  190.  
  191. Operators
  192. ---------
  193.  
  194. The vi operators (d, c, y, <, and >) work as true operators. The only
  195. exception is that the change operator works only for character-oriented
  196. changes (like cw or c%) and not for line-oriented changes (like cL or c3j).
  197.  
  198.  
  199. Tags
  200. ----
  201.  
  202. Tags are implemented and a fairly simple version of 'ctags' is supplied
  203. with the editor. The current version of ctags will find functions and
  204. macros following a specific (but common) form.  See 'ctags.doc' for a
  205. complete discussion.  [The full Ctags program is in the public domain;
  206. contact your nearest comp.sources.unix archive site; the primitive
  207. tags has been taken out of this c.s.u distribution.]
  208.  
  209.  
  210. System-Specific Comments
  211. ------------------------
  212.  
  213. The following sections provide additional relevant information for the
  214. systems to which STEVIE has been ported.
  215.  
  216.  
  217. Atari ST
  218. --------
  219.  
  220. The editor has been tested in all three resolutions, although low and
  221. high res. are less tested than medium. The 50-line high res. mode can
  222. be used by setting the 'lines' parameter to 50. Alternatively, the
  223. environment variable 'LINES' can be set. The editor doesn't actively
  224. set the number of lines on the screen. It just operates using the number
  225. of lines it was told.
  226.  
  227. The arrow keys, as well as the <INSERT>, <HELP>, and <UNDO> keys are
  228. all mapped appropriately.
  229.  
  230.  
  231. UNIX
  232. ----
  233.  
  234. The editor has been ported to UNIX System V release 3. This was done
  235. mainly to get some profiling data so I haven't put much effort into
  236. doing the UNIX version right. It's hard-coded for ansi-style escape
  237. sequences and doesn't use the termcap/terminfo routines at all.
  238.  
  239.  
  240. OS/2
  241. ----
  242.  
  243. This port was done because the editor that comes with the OS/2 developer's
  244. kit really sucks. Make sure 'ansi' mode is on (using the 'ansi' command).
  245. The OS/2 ansi driver doesn't support insert/delete line, so the display
  246. updates are a little rough, but the editor is fast enough that it isn't
  247. too bothersome. The arrow keys are NOT mapped, so they don't currently do
  248. anything reasonable.
  249.  
  250.  
  251. Missing Features
  252. ----------------
  253.  
  254. 1. Counts aren't yet supported everywhere that they should be.
  255.  
  256. 2. Macros with support for the ST function keys.
  257.  
  258. 3. More "set" options.
  259.  
  260. 4. Auto-indent.
  261.  
  262. 5. Many others...
  263.  
  264.  
  265.  
  266. Known Bugs and Problems
  267. -----------------------
  268.  
  269. 1. Undo is partially disabled until I can re-work some of the code for
  270.    undoing certain edit operations. Undo is enabled for those operations
  271.    where I've specifically checked out the code. All other cases print
  272.    an apologetic message for the time being. Recent changes to the editor
  273.    broke some of the old 'undo' code. This is a temporary hack until I
  274.    can check out all the undo code.
  275.  
  276. 2. The change operator is only half-way implemented. It works for character
  277.    motions but not line motions. This isn't so bad since most change
  278.    operations are character oriented anyway.
  279.  
  280. 3. The yank buffer uses statically allocated memory, so yanks of more than
  281.    1K of text will fail. If a delete spans more than 1K, the program asks
  282.    for confirmation before proceeding. That way, if you were moving text,
  283.    you don't get screwed by the limited yank buffer. You just have to move
  284.    smaller chunks at a time. All the internal buffers (yank, redo, etc.)
  285.    need to be reworked to allocate memory dynamically.
  286.  
  287. 4. If you stay in insert mode for a long time, the insert buffer can overflow.
  288.    The editor will print a message and dump you back into command mode.
  289.  
  290. 5. Puts are very slow.
  291.  
  292. 6. Several other less bothersome glitches...
  293.  
  294.  
  295. Conclusion
  296. ----------
  297.  
  298. I'm still working on the program pretty actively, although the farther I
  299. get with it, the harder it is to get motivated to work on it. I've been
  300. using it as my standard editor for a long time, and I suppose I'm coming
  301. to accept its deficiencies more than I should. Fortunately, I use the
  302. real vi every day at work, so I'm constantly reminded of the work that
  303. remains to be done.
  304.  
  305. I'd like to thank Tim Thompson for writing the original version of the
  306. editor. His program was well structured and quite readable. Thanks for
  307. giving me a good base to work with.
  308.  
  309. If you're reading this file, but didn't get the source code for STEVIE,
  310. it can be had by sending a disk with return postage to the address given
  311. below. I can write disks for the Atari ST (SS or DS) or MSDOS (360K or
  312. 1.2M). Please be sure to include the return postage. I don't intend to
  313. make money from this program, but I don't want to lose any either.
  314.  
  315. I'm not planning to try to coordinate the various ports of STEVIE that
  316. may occur. I just don't have the time. But if you do port it, I'd be
  317. interested in hearing about it. I will be doing a port for Minix on the
  318. ST when that becomes available later this year. So if anyone does a
  319. Minix port on the PC, I'd be especially interested.
  320.  
  321.  
  322. Tony Andrews            UUCP: onecom!wldrdg!tony
  323. 5902E Gunbarrel Ave.
  324. Boulder, CO 80301
  325.  
  326.  
  327. Character Function Summary
  328. --------------------------
  329.  
  330. The following list describes the meaning of each character that's used
  331. by the editor. In some cases characters have meaning in both command and
  332. insert mode; these are all described.
  333.  
  334. ^@    The null character. Not used in any mode. This character may not
  335.     be present in the file, as is the case with vi.
  336.  
  337. ^B    Backward one screen.
  338.  
  339. ^D    Scroll the window down one half screen.
  340.  
  341. ^E    Scroll the screen up one line.
  342.  
  343. ^F    Forward one screen.
  344.  
  345. ^G    Same as ":f" command. Displays file information.
  346.  
  347. ^H (BS)    Moves cursor left one space in command mode. In insert mode, erases
  348.     the last character typed.
  349.  
  350. ^J    Move the cursor down one line.
  351.  
  352. ^L    Clear and redraw the screen.
  353.  
  354. ^M (CR)    Move to the first non-white character in the next line. In insert
  355.     mode, a carriage return opens a new line for input.
  356.  
  357. ^N    Move the cursor down a line.
  358.  
  359. ^P    Move the cursor up a line.
  360.  
  361. ^U    Scroll the window up one half screen.
  362.  
  363. ^Y    Scroll the screen down one line.
  364.  
  365. ^[    Escape cancels a pending command in command mode, and is used to
  366.     terminate insert mode.
  367.  
  368. ^]    Moves to the tag whose name is given by the word in which the cursor
  369.     resides.
  370.  
  371. ^`    Same as ":e #" if supported (system-dependent).
  372.  
  373. SPACE    Move the cursor right on column.
  374.  
  375. $    Move to the end of the current line.
  376.  
  377. %    If the cursor rests on a paren '()', brace '{}', or bracket '[]',
  378.     move to the matching one.
  379.  
  380. '    Used to move the cursor to a previously marked position, as in
  381.     'a or 'b. The cursor moves to the start of the marked line. The
  382.     special mark '' refers to the "previous context".
  383.  
  384. +    Same as carriage return, in command mode.
  385.  
  386. ,    Reverse of the last t, T, f, or F command.
  387.  
  388. -    Move to the first non-white character in the previous line.
  389.  
  390. .    Repeat the last edit command.
  391.  
  392. /    Start of a forward string search command. String searches may be
  393.     optionally terminated with a closing slash. To search for a slash
  394.     use '\/' in the search string.
  395.  
  396. 0    Move to the start of the current line. Also used within counts.
  397.  
  398. 1-9    Used to add 'count' prefixes to commands.
  399.  
  400. :    Prefix character for "ex" commands.
  401.  
  402. ;    Repeat last t, T, f, or F command.
  403.  
  404. <    The 'left shift' operator.
  405.  
  406. >    The 'right shift' operator.
  407.  
  408. ?    Same as '/', but search backward.
  409.  
  410. A    Append at the end of the current line.
  411.  
  412. B    Backward one blank-delimited word.
  413.  
  414. C    Change the rest of the current line.
  415.  
  416. D    Delete the rest of the current line.
  417.  
  418. E    End of the end of a blank-delimited word.
  419.  
  420. F    Find a character backward on the current line.
  421.  
  422. G    Go to the given line number (end of file, by default).
  423.  
  424. H    Move to the first non-white char. on the top screen line.
  425.  
  426. I    Insert before the first non-white char. on the current line.
  427.  
  428. J    Join two lines.
  429.  
  430. L    Move to the first non-white char. on the bottom screen line.
  431.  
  432. M    Move to the first non-white char. on the middle screen line.
  433.  
  434. N    Reverse the last string search.
  435.  
  436. O    Open a new line above the current line, and start inserting.
  437.  
  438. P    Put the yank/delete buffer before the current cursor position.
  439.  
  440. T    Reverse search 'upto' the given character.
  441.  
  442. W    Move forward one blank-delimited word.
  443.  
  444. X    Delete one character before the cursor.
  445.  
  446. Y    Yank the current line. Same as 'yy'.
  447.  
  448. ZZ    Exit from the editor, saving changes if necessary.
  449.  
  450. [[    Move backward one C function.
  451.  
  452. ]]    Move forward one C function.
  453.  
  454. ^    Move to the first non-white on the current line.
  455.  
  456. `    Move to the given mark, as with '. The distinction between the two
  457.     commands is important when used with operators. I support the
  458.     difference correctly. If you don't know what I'm talking about,
  459.     don't worry, it won't matter to you.
  460.  
  461. a    Append text after the cursor.
  462.  
  463. b    Back one word.
  464.  
  465. c    The change operator.
  466.  
  467. d    The delete operator.
  468.  
  469. e    Move to the end of a word.
  470.  
  471. f    Find a character on the current line.
  472.  
  473. h    Move left one column.
  474.  
  475. i    Insert text before the cursor.
  476.  
  477. j    Move down one line.
  478.  
  479. k    Move up one line.
  480.  
  481. l    Move right one column.
  482.  
  483. m    Set a mark at the current position (e.g. ma or mb).
  484.  
  485. n    Repeat the last string search.
  486.  
  487. o    Open a new line and start inserting text.
  488.  
  489. p    Put the yank/delete buffer after the cursor.
  490.  
  491. r    Replace a character.
  492.  
  493. s    Replace characters.
  494.  
  495. t    Move forward 'upto' the given character on the current line.
  496.  
  497. u    Undo the last edit. This isn't currently supported very well.
  498.  
  499. w    Move forward one word.
  500.  
  501. x    Delete the character under the cursor.
  502.  
  503. y    The yank operator.
  504.  
  505. z    Redraw the screen with the current line at the top (zRETURN),
  506.     the middle (z.), or the bottom (z-).
  507.  
  508. |    Move to the column given by the preceding count.
  509.  
  510.