dan@rna.UUCP (Dan Ts'o) (06/29/85)
# Here is part 6 of the sources to VSH, a visual shell. # # # Cheers, # Dan Ts'o # Dept. Neurobiology # Rockefeller Univ. # 1230 York Ave. # NY, NY 10021 # 212-570-7671 # ...cmcl2!rna!dan echo doc/vsh.1 sed 's/^X//' > doc/vsh.1 << 'All work and no play makes Jack a dull boy' X.TH VSH 1 X.SH NAME XVsh \- visual shell X.SH SYNOPSIS X.B vsh X[ X.B "-" X] [ X.B "-f" X] X.SH DESCRIPTION X.I Vsh Xis a highly interactive, visually oriented shell Xwhich eases many programming activities. XMost commands involve only a single keypress. XThese commands cause directories to be displayed, Xeditors to be entered, Xand compilers to be invoked. XBeginners should find X.I vsh Xeasier to learn then the conventional shell. X.PP XOn entry to X.I vsh, Xthe current directory is plotted on the screen. XEach member of the directory is labeled with a letter. XTo select a member, Xone presses its corresponding letter. XWhat happens after selection depends on the nature of the member. XIf the member is a directory, X.I vsh Xchanges to that directory. XText files are edited. XFull details are given later in this manual. X.PP X.I Vsh Xdisplays up to twenty files at a time on a standard 80x24 CRT. XDirectories which are larger are broken into Xpages of twenty files each. XThere are as many pages as are required to display the entire Xcurrent directory. XTo select a page, one presses a digit X.B 0-9. XPages are numbered starting at one with X.B 0 Xselecting the last page. X.PP XA well integrated feature of X.I vsh Xis its connection between compilers and editors. XTo start a compile, one presses X.B M. X.I Vsh Xthen calls on X.IR make (1). XThe output of this compile step is saved, Xand one can later review for compile-time errors. X.I Vsh Xnumbers each error. XOne can select an error by typing in its number. XAfter selection, X.I vsh Xcalls an editor, Xsending one to the proper file at the offending line. XOne can jump between the editor and X.I vsh Xuntil one is ready for another compile. X.PP X.SH ENVIRONMENT PARAMETERS X.PP X.de UX X.B UNIX X.. X.I Vsh Xtakes the following parameters from the global environment: X.TP 18 X.B HOME XThe home directory. This parameter is automatically set by X.UX Xwhen one logs in. X.TP X.B SHELL XThe user's login shell. X.UX Xalso sets this parameter. XWhen it is necessary to escape to a shell, Xthis parameter selects the program to use. X.TP X.B EDITOR XThe user's choice of editor. This parameter defaults to X.I vi(1). X.TP X.B PATH XThe list of directories searched for commands. X.TP X.B TERM XThe terminal type. XThe terminal must be cursor addressable. X.PP XThe user must set the X.B TERM Xparameter himself. XAs an example, to indicate your terminal is an adm3a, from X.IR csh (1) Xtype: X.PP X.B \ \ \ \ \ %\ setenv\ TERM\ adm3a X.PP XFrom X.IR sh (1) Xtype: X.PP X.B \ \ \ \ \ $\ TERM=adm3a;\ \ export\ TERM X.PP XSee X.IR termcap (5) Xfor more information about the TERM parameter. X.PP XBased on X.I termcap, X.I vsh Xdetermines whether the terminal is a CRT capable of Xrunning X.I vsh. X.I Vsh Xrecognizes two command line options, X.TP 18 X.B - XIf not a useable CRT, exec the shell instead. Useful if X.I vsh Xis your login shell. X.TP X.B -f XTry to run X.I vsh Xeven if X.I termcap Xsays that the terminal is incapable. Useful for running X.I vsh Xin command scripts. X.ne 10v X.SH FILE SELECTION X.PP XAs indicated before, one selects a file by pressing Xits corresponding letter. XWhat happens after selection depends on the nature of the file. X.TP 18 X.B File type X.B Action X.sp X.TP X.B Directory XChange to new directory. X.TP X.B Archive XPrint archive directory. This works for both X.IR ar (1) Xand X.IR cpio (1) Xformatted archives. X.TP X.B Object program XPrint name list (external symbols). X.TP X.B Core XInvoke the debugger. X.TP X.B Compressed file XThe file is tested if it has been compressed by several Xof the common compression programs, including X.I pack, X.I compact, Xand X.I compress. XThe appropriate decompressor is then invoked. However no check Xis made if the resulting output is text or binary data. X.TP X.B Device XSelection fails. X.TP X.B Others, text XA quick test is performed to guess if the file is ASCII text. If the test Xsucceeds, EDITOR is invoked (but see the discussion of the parameter X.I entertext Xfor alternatives). X.br X.ne 10v X.SH DIRECTORY OPERATIONS X.PP XThis is a list of the directory commands. XBefore doing anything else, the user should become Xfamiliar with commands which allow him to Xselect files and display directories. XIn directories larger than twenty files, Xthe user should be able to display each page with the commands given below. X.br X.ne 10v X.TP 18 X.B Command X.B Action X.sp 1 X.TP X.B ^D X:sh XLeave X.I vsh. X.TP X.B a-z XSelect corresponding file. X.TP X.B 1-9 XSelect page 1-9. X.TP X.B 0 XSelect the last page. X.TP X.B + XSelect next page. X.TP X.B ^F,\ ^D XSame as X.B +. X.TP X.B \- XSelect previous page. X.TP X.B ^U XSame as X.B -. X.TP X.B ^\ (Home) XChange to home directory. X.TP X.B / XChange to root directory. X.sp X.ta 18n X.in .5i X\fB\\\fP Change to previous directory. X.in X.DT X.TP X.B ? XDisplay help file. X.TP X.B ! XEscape to SHELL. X.TP X.B % XChain to SHELL (does not return to X.I vsh X). X.TP X.B . XFind page with files beginning with a certain character (prompted for). X.TP X.B $ XEscape to the Bourne shell. X.TP X.B -Line\ Feed- XChange to previous (parent) directory. X.TP X.B ^L XRepaint the display. X.PP X.br X.ne 12v X.ti -5 XThese are convenience commands. X.TP 18 X.B D XDisplay date. X.TP X.B T XDisplay a text file using the X.I vsh Xpager. X.I Vsh Xprompts for a file and displays it as ascii text. XThis is faster than a selection which calls the editor. X.TP X.B P XProcess status. Call /bin/ps. X.TP X.B W XWho. Display who is logged in. X.TP X.B X XExecute a shell command (prompted for). X.TP X.B Y XRe-execute previous shell command (entered via X.B X X). X.PP X.ti -5 XThese are advanced commands. X.TP 18 X.B F XSelect file by name. X.I Vsh Xprompts for a file name. X.I Vsh Xthen selects the specified file. X.TP X.B C XCreate a new file. X.I Vsh Xprompts for a file name and file type. XOne may create text files and directories. XOne may also copy, rename and link from existing files. X.TP X.B L XLong format file listing. XNext to each file, X.I vsh Xdisplays protection information in the same manner as X.IR ls (1). X.TP X.B O XOption listing. XThe contents of command and parameter tables are displayed. X.I Vsh Xthen prompts for commands which modify parameters and which Xcreate, modify, and delete commands. X.SH REMOVE MODE X.PP XPress X.B R Xto enter X.I Remove\ mode. XIn X.I Remove\ mode, Xselecting a file causes it to be marked for removal Xwith two slashes, "//." XFiles selected a second time are unmarked. XPressing X.B R Xa second time causes all marked files to be removed. XThe following commands are available in X.I Remove\ mode: X.TP 18 X.B Command X.B Action X X.TP X.B -Return- XExit X.I Remove\ mode Xwith out removing marked files. X.TP X.B ^D XSame as X.B -Return- X.TP X.B a-z XSelect corresponding file for removal. X.TP X.B * XSelect all files on current page for removal. X.TP X.B 0\-9,\ +,\ \- XSelect and display another page. XThese commands are described earlier in the manual in Xthe section on directory operations. X.TP X.B ? XDisplay help file. X.TP X.B R XRemove marked files and exit X.I Remove\ mode. XIf X.I vsh Xcannot remove a file, X.I vsh Xdisplays the reason and waits for a response. XPress X.B -Return- Xto continue removing marked files. XPress X.B ^D Xto immediately exit from X.I Remove\ mode. X.SH MAKE, GREP, AND SHOWFILE X.PP X.I Vsh Xinterfaces to X.IR make (1) Xand X.IR grep (1). X.I Vsh Xsaves output from these programs and allows one to examine the Xresults in X.I showfile\ mode. XFrom the directory page, the following commands control X.I make,\ grep, Xand X.I showfile. X.sp 1 X.TP 18 X.B G X.IR grep (1). X.I Vsh Xprompts for a pattern and file names, and then run X.I grep Xwith these parameters. XThe results are saved in the file X.I .grepout Xand displayed in X.I showfile\ mode. X.TP X.B S XShow previous X.I grep. XThe output of the last X.I grep Xis displayed in X.I showfile\ mode. X.TP X.B M X.IR Make (1) X.I Vsh Xruns X.I make. XExecution is controlled by the X.I makefile Xin the current directory. XOutput is both displayed on the screen and saved in the file X.I .makerror. XWhen X.I make Xterminates, X.I vsh Xdisplays X.I .makerror Xin X.I showfile\ mode. X.TP X.B N X.IR make (1) Xrunning independently. X.I Make Xis run but X.I vsh Xdoes not wait for termination. XOutput is saved in X.I .makerror, Xbut is not displayed on the screen. XWhen X.I make Xterminates, Xthe bell on your terminal rings twice. XUse Xthe X.B E Xcommand to review the output in X.I .makerror. X.TP X.B E XReview errors. XThe results of the last X.I make Xare displayed in X.I showfile\ mode. X.br X.ne 10v X.SH SHOWFILE MODE X.PP X.I Showfile Xdisplays the results of a X.I make Xor X.I grep. XIt is called by the X.B E Xand X.B S Xcommands. X.I Showfile Xis called automatically in the course of an X.B M Xor X.B G Xcommand. X.I Showfile Xis essentially a special editor. XIt has commands which allow one to display a file. XOne can also command X.I showfile Xto examine a line of the file. X.I Showfile Xscans this line and attempt to extract a file name Xand line number. X.I Showfile Xthen runs the editor, Xstarting it at the specified line. X.PP X.br X.ne 10v XThese are the X.I showfile Xcommands. XIt is not necessary to press -Return- after these commands. XWhen a complete command is sensed, Xit is run immediately. X.TP 18 X.B Command X.B Action X.sp X.TP X.B number\ p XPrint file starting at specified line. X.TP X.B number\ e XExamine line for a file name and line number. XIf a file name is found, run the editor on this file. X.TP X.B -Return- XDisplay next twelve lines. X.TP X.B number\ -Return- XSame as X.B "number e" X.TP X.B ^D XLeave X.I showfile. X.TP X.B q XLeave X.I showfile. X.TP X.B ? XDisplay help file. X.PP XAll commands from the directory page which might be useful Xare available in X.I showfile\ mode. XThey include X.B ^, /, !, Xand X.B A Xthrough X.B Z Xexcept X.B L Xand X.B R. XParticularly useful are X.B M Xand X.B G Xwhich allow new iterations of X.I make Xand X.I grep, X.B !, Xthe escape to the shell, Xand X.B F, Xwhich allows one to edit files not found in the Xfile being shown. X.SH CONTROL COMMANDS X.PP XThe operation of X.I vsh Xis controlled by its parameter and command tables. XThe contents of these tables can be displayed via the X.B O Xcommand. XThese tables can be modified with control commands. XWhen X.I vsh Xis invoked, it searches for the file X.I .vshrc Xin your home directory. XControl comands are then read from this file, Xallowing one to create a personalized environment. XThe X.B O Xcommand also prompts for control commands, Xallowing for interactive modification of the tables. X.PP XThese control commands should be presented in the same Xlexical grammar as shell commands. XSpaces and tabs separate tokens. XUnquoted newlines terminate each statement. XA character may be quoted by preceding it with a X.B X\\. XAll characters inside single quotes (' ') are quoted except the Xsingle quote. XInside double quotes (" "), X.B X\\ Xquotes another double quote and X.B X\\newline Xis ignored. XGrave accents (` `) are treated as any other character. XThe lexical grammar is compatible with that of X.IR sh (1). XThe grammar is somewhat different from that of X.IR csh (1). X.PP X.br X.ne 20v XTo change a parameter, use the following format in X.I .vshrc Xor to the X.B O Xcommand: X.PP X.B X\ \ \ \ \ PARAMETER\-NAME\ \ PARAMETER\-VALUE X.PP X.B PARAMETER\-NAME Xcan be any of the following: X X.TP 18 X.B Parameter X.B Usage X.sp X.TP X.B EDITOR XPreferred editor. Default is X.I vi. X.TP X.B HOME XHome directory. Default is $HOME. X.TP X.B TERM XTerminal type. X.TP X.B PATH XCommand search list. Default is $PATH. X.TP X.B SHELL XShell for escapes. Default is $SHELL. X.TP X.B MAIL XFile to check for new mail. Default is /usr/spool/mail/$USER or $MAIL. X.TP X.B make XMake program. Default is X.I /bin/make. X.TP X.B makerror XFile for error output of X.B make. XDefault is .makerror . X.TP X.B grep Xgrep program. Default is X.I /bin/grep. X.TP X.B grepout XFile for output of X.B grep. XDefault is .grepout . X.TP X.B quitchar XCharacter command to leave X.I vsh. XDefault is X.I control-D. X.B quitchar Xis expressed as the desired ASCII character plus octal 0100. XThus X.I control-D Xis expressed as D and X.I escape Xis expressed as [. X.TP X.B pagechar XAn alternate character command for '+', to advance the file display. X.B pagechar Xis also expressed as the desired ASCII character plus octal 0100. XDefault is ';' which is expressed as '{'. X.TP X.B rmhelp XRemove mode help file. Default is /usr/lib/vsh/rmhelp. X.TP X.B showhelp XShow mode help file. Default is /usr/lib/vsh/showhelp. X.TP X.B vshmode X.I Vsh Xoperating mode. Default is X.I enter. XIn X.I entermode, X.I vsh Ximmediately enters a selected file. XThe other alternative is X.I selectmode, Xin which X.I vsh Xplaces an arrow beside the selected file and waits for another Xkey press to determine the operation to perform on the selected file. X.TP X.B entertext XDetermine how X.I vsh Xshould enter text files. The default is X.I $EDITOR Xwhere X.I vsh Xinvokes X.I $EDITOR Xon the text file. Another alternative is X.I display, Xwhere X.I vsh Xinvokes the internal text pager (similar to X.I more(1) X) on the text file. XIf X.B entertext Xis neither of these two alternatives, its value is interpreted Xas a program name which should be invoke on the text file. X.TP X.B helpfile XFile name of a help file to display on the right side of the screen. XDefault is $HOME/.vshelp . If X.B helpfile Xis not defined or the named file non-existant, no help menu is displayed. X.TP X.B window XNumber of screen lines to use for the file display. The default is the Xentire screen up to 26+4 lines. X.TP X.B column XNumber of columns of files to use in the file display. The default is one. XEach column occupies 19 spaces - thus an 80 column screen can have at most Xfour columns. It is permissible to specify more columns than possible. X.TP X.B noargprompt XIf defined, causes X.I vsh Xto ignore missing arguments when executing commands. Default is to Xprompt for missing arguments. X.TP X.B VImotion XUse X.I vi(1) Xstyle cursor motions X.I hjkl Xto move the select pointer around the file display. Pre-empts the meaning Xof X.I hjkl Xas file letter selectors and only meaningful when X.B vshmode Xis X.I select. X.TP X.B moresize XSet memory size for the X.I vsh Xinternal pager. Default is 10000. Governs amount of text which can be Xscrolled through in reverse. X.TP X.B enterpath XList of directories to search for a file entered via Xthe X.I vsh X.B file Xcommand (default bound to X.B F X). XDefault is ':', just the current directory. X.sp X.br X.ne 10v X.PP XTo define a command, use the following format in X.I .vshrc Xor to the X.B O Xcommand: X.PP X.B X\ \ \ \ \ CHARACTER\ \ KEYWORD\ \ [PARAMETERS\ ...] X.PP XCHARACTER is the character which calls the new command. XValid characters are X.B X! " # $ % & ' ( ) : * = ^ ~ [ ] { } < > , . / ? Xand X.B A\-Z. X.br X.ne 15v X.PP XThese are the valid keywords: X.TP 18 X.B Keyword X.B Purpose X.sp X.TP 18 X.B date XDisplay date. X.TP X.B showerror XShow errors from previous X.I make. X.TP X.B showgrep XShow output from previous X.I grep. X.TP X.B file XSelect a file. If parameter is present, Xthe parameter is selected. Otherwise, X.I vsh Xwill prompt for a file name. X.TP X.B home XChange to home directory. X.TP X.B grep XRun X.I grep. X.I Vsh Xwill prompt for parameters. X.TP X.B wmake XRun X.I make. XWait for termination. X.TP X.B fmake XRun X.I make. XDo not wait for termination. X.TP X.B remove XEnter X.I Remove\ mode. X.TP X.B longlist XPrint long format listing of files on the current page. X.TP X.B display XDisplay the contents of a file. XIf no parameter is present, X.I vsh Xwill prompt for a file name. X.TP X.B options XDisplay X.I vsh Xoptions (parameter and command tables). XAccept commands which modify parameters and Xwhich create, modify, and delete commands. X.TP X.B exec XExecute a program directly with the exec system call. XThe first parameter must be the program name. XDirectories are not successively searched as in the shell. XAny other parameters become parameters to the program. XIf it is necessary to redirect files, to expand macros, Xor to expand file regular expressions, use the X.B shell Xor X.B xecute Xkeyword instead. X.TP X.B pexec XLike X.B exec Xbut the command's output is processed through the X.I vsh Xinternal pager (similar to X.I more(1) X). X.TP X.B shell XIf no parameter is present, an interactive shell is spawned. XIf one parameter is present, it is passed to the shell Xand run as a command. Do not specify more than one parameter. XInstead, enclose the entire shell command in quotes Xto provide X.I vsh Xwith only one parameter. X.TP X.B create X.I Vsh Xprompts for a new file name. The file is created. XIf the file already exists, X.B create Xwill refuse to overwrite it unless a ! precedes the file name. X.TP X.B xecute XExecute one shell command (like X.B shell X), prompt if no command is given. X.TP X.B rexecute XRe-execute previous X.B xecute Xcommand. X.TP X.B chain XChain (exec without fork) to a new command (never returns to X.I vsh X). X.TP X.B null XUndefines a command. X.SH ADVANCED USAGE X.SH SELECT MODE XThe default mode for X.I vsh Xdescribed above is called X.I entermode. XIn this mode, files are X.I entered Ximmediately upon selection via a single keypress of X.I a-z. XThe operation performed on the selected file is determined by the Xfile type. X.I Vsh Xhas another, more advanced mode of operation, X.I selectmode. XThis mode is enabled when the parameter X.B vshmode Xis set to X.I select. XWhen X.I vsh Xis in X.I selectmode, Xtwo keypresses are required to initiate an operation. The first, as in X.I entermode, Xselects the desired file, X.I a-z. XAn arrow appears next to the file selected. XThe second keypress then determines the operation to be performed on the Xselected file. If the same file (keypress) X.I a-z Xor ` or X.I "carriage return" Xis chosen, the file is X.I entered Xin a manner identical to X.I entermode, Xi.e. based on file type. XIf another file X.I a-z Xis selected, that file becomes the current selected file, and the arrow Xappears next to that file instead. If a command character is pressed X( X.I A-Z, Xor others), that command is invoked and the selected file is available as Xan argument to that command. Whether the invoked command actually uses the Xselected file or not depends on whether the command was defined to use it. X.PP XThe following predefined commands (see above) are interfaced to X.I selectmode, X.TP 18 X.B Keyword X.B Effect X.sp X.TP 18 X.B display XDisplay the contents of the selected file. X.TP X.B create XCreate a new file. The selected file may be used for rename, copy or link Xoperations. X.PP XThe following commands are interfaced to X.I selectmode Xby the token $ which is replaced by the name of the selected file. X.TP 18 X.B grep XSearch for pattern in named file(s). The named file may be '$' which specifies Xthe selected file. XWherever a $ token appears in a command definition using the following Xprogram execution keywords, it is replaced by the name of the selected file. X.TP X.B exec XExecute a program. X.TP X.B pexec XLike exec but filters the standard output Xthrough the X.I vsh Xinternal pager (similar to X.I more(1) X). X.TP X.B xecute XExecute one shell command (like X.B shell X), prompt if no command is given. X.TP X.B rexecute XRe-execute previous X.B xecute Xcommand. X.PP XThus to define the letter X.I v Xas a command to invoke X.I /bin/vi Xon a selected file, one types X.PP X v exec /bin/vi $ X.PP Xto the X.I options Xcommand, or in X.I .vshrc XIn addition, for X.B exec Xand X.B pexec, Xeach argument beginning with ?? is printed as a prompt message and Xa string is obtained from the terminal to place that argument. X.SH MULTICOLUMN DISPLAYS XInstead of a single column of files per screen, X.I vsh Xcan display multiple columns of files each column corresponding to a X.I vsh Xpage. This type of display is not compatible with the help menu display Xenable by the X.B helpfile Xparameter. Multicolumn displays are enabled by setting the parameter X.B column Xto the number of desired columns. Each occupies 19 spaces. X.I Emacs Xcursor commands are available to move the X.I selectmode Xarrow around the multicolumned file display. The X.I vi Xcommands X.B hjkl Xare also available but the option X.B VImotion Xshould be set to avoid conflict with the X.I a-z Xinterpretation of these keys in file selection. X.SH INTERNAL PAGER X.I Vsh Xhas an internal pager similar to X.I more(1) Xthat is used with the X.B display Xand X.B pexec Xcommands. XThe following commands are available when in the pager. X.TP 18 X.B "1,<" XGo to the first line. X.TP X.B "G,>" XGo to the last line. X.TP X.B "?,^R" XReverse search X.TP X.B "/,^S" XForward search X.TP X.B "e,v" XInvoke $EDITOR X.TP X.B "-,^P,k" XPrevious line X.TP X.B "<CR>,^N,j" XNext line X.TP X.B "^U" XPrevious half page. X.TP X.B "^D" XNext half page. X.TP X.B "^B,^" XPrevious full page. X.TP X.B "^L" XRepaint screen. X.TP X.B "!" XFork a subshell. X.TP X.I "(anything else)" XNext full page. X.PP XThe forward and reverse searches prompt for a string pattern which Xsupports only the ^ . $ regular expression operators. A forward Xsearch can cause a file to hit EOF. In this case, the wraparound can Xfail if the more buffer size is insufficient to hold the entire file X(see the parameter X.B moresize X). XReverse searches do not wraparound. If no pattern is entered, the previous Xpattern is used. X.SH HINTS X.PP XWhen typing in a file name (e.g. to the X.B file Xcommand), ! means the last file name typed in. X.PP XIf the program name invoked by X.B exec Xor X.B xecute Xbegins with ; the screen is updated immediately after the program Xterminates. This feature facilitates screen/command interactions X(i.e. cleans up the screen and doesn't slow you down). X.PP XA ~ in the beginning of a file name is replaced with a user's login Xdirectory, as in X.I csh(1). X.PP XIt is generally preferable to use X.I selectmode Xand define X.B entertext Xas X.I display. XUsed this way X.I vsh Xcan speedily examine the contents of text files without the overhead Xof invoking a separate editor. Use the invoke editor command within Xthe pager to invoke an editor and also define a separate command which Xinvokes your favorite editor on a selected file. X.PP XThe best way to change directories is with the X.B file Xkeyword. It is particularly efficient to bind X.B file Xto / since / often appears at the beginning of pathnames and is usually Xa non-shifted key. X.PP XThe X.I vsh Xdisplay works best with terminals that support the X.I termcap XCS capability (change scrolling regions). All VT100 emulators and other XANSI-like terminals should have this feature. With the CS capability, Xit is then optimal on a 80x24 terminal to set X.B window Xto 11 (a-g plus two lines each on top and bottom). Then one can use the X.I vi X.B hjkl Xwithout ambiguity and have a reasonably large pager region. With larger XVT100-like terminals, such as the CIT-500 and the Bitgraph, one can set X.B window Xto as large as 30 (26 + 4). X.PP XUsing the X.B O Xcommand for changing options and parameters is best for making temporary Xchanges to the configuration for X.I vsh. XWhen making permanent changes to one's X.I vsh Xconfigration, it is best to alter X.I .vshrc. XIt is convenient to define a X.I vsh Xcommand to X.B chain Xto X.I vsh Xitself. Then to make a permanent change to the X.I vsh Xconfiguration, one simply edits X.I .vshrc Xand then uses the X.B chain Xto X.I vsh Xto overlay the current X.I vsh Xwith one which has read in the new X.I .vshrc. X.SH FILES X.ta 2i X$HOME/.vshrc initialization file. X.br X/etc/termcap terminal capability database necessary for addressing cursor. X.br X/bin/pwd for determining the path name of the working directory. X.br X/dev/null data sink. X.br X/usr/lib/vsh/* supporting documentation and help files. All work and no play makes Jack a dull boy echo doc/vsh.out sed 's/^X//' > doc/vsh.out << 'All work and no play makes Jack a dull boy' X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X XNAME X Vsh - visual shell X XSYNOPSIS X vsh [ - ] [ -f ] X XDESCRIPTION X _V_s_h is a highly interactive, visually oriented shell which X eases many programming activities. Most commands involve X only a single keypress. These commands cause directories to X be displayed, editors to be entered, and compilers to be X invoked. Beginners should find _v_s_h easier to learn then the X conventional shell. X X On entry to _v_s_h, the current directory is plotted on the X screen. Each member of the directory is labeled with a X letter. To select a member, one presses its corresponding X letter. What happens after selection depends on the nature X of the member. If the member is a directory, _v_s_h changes to X that directory. Text files are edited. Full details are X given later in this manual. X X _V_s_h displays up to twenty files at a time on a standard X 80x24 CRT. Directories which are larger are broken into X pages of twenty files each. There are as many pages as are X required to display the entire current directory. To select X a page, one presses a digit 0-9. Pages are numbered starting X at one with 0 selecting the last page. X X A well integrated feature of _v_s_h is its connection between X compilers and editors. To start a compile, one presses M. X _V_s_h then calls on _m_a_k_e(1). The output of this compile step X is saved, and one can later review for compile-time errors. X _V_s_h numbers each error. One can select an error by typing X in its number. After selection, _v_s_h calls an editor, send- X ing one to the proper file at the offending line. One can X jump between the editor and _v_s_h until one is ready for X another compile. X XENVIRONMENT PARAMETERS X _V_s_h takes the following parameters from the global environ- X ment: X X HOME The home directory. This parameter is X automatically set by UNIX when one logs X in. X X SHELL The user's login shell. UNIX also sets X this parameter. When it is necessary to X escape to a shell, this parameter selects X the program to use. X X X X XPrinted 6/26/85 1 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X EDITOR The user's choice of editor. This parame- X ter defaults to _v_i(_1). X X PATH The list of directories searched for com- X mands. X X TERM The terminal type. The terminal must be X cursor addressable. X X The user must set the TERM parameter himself. As an exam- X ple, to indicate your terminal is an adm3a, from _c_s_h(1) X type: X X % setenv TERM adm3a X X From _s_h(1) type: X X $ TERM=adm3a; export TERM X X See _t_e_r_m_c_a_p(5) for more information about the TERM parame- X ter. X X Based on _t_e_r_m_c_a_p, _v_s_h determines whether the terminal is a X CRT capable of running _v_s_h. _V_s_h recognizes two command line X options, X X - If not a useable CRT, exec the shell X instead. Useful if _v_s_h is your login X shell. X X -f Try to run _v_s_h even if _t_e_r_m_c_a_p says that X the terminal is incapable. Useful for run- X ning _v_s_h in command scripts. X XFILE SELECTION X As indicated before, one selects a file by pressing its X corresponding letter. What happens after selection depends X on the nature of the file. X X File type Action X X X Directory Change to new directory. X X Archive Print archive directory. This works for X both _a_r(1) and _c_p_i_o(1) formatted archives. X X Object program Print name list (external symbols). X X Core Invoke the debugger. X X Compressed file The file is tested if it has been X X X XPrinted 6/26/85 2 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X compressed by several of the common X compression programs, including _p_a_c_k, _c_o_m_- X _p_a_c_t, and _c_o_m_p_r_e_s_s. The appropriate X decompressor is then invoked. However no X check is made if the resulting output is X text or binary data. X X Device Selection fails. X X Others, text A quick test is performed to guess if the X file is ASCII text. If the test succeeds, X EDITOR is invoked (but see the discussion X of the parameter _e_n_t_e_r_t_e_x_t for alterna- X tives). X XDIRECTORY OPERATIONS X This is a list of the directory commands. Before doing any- X thing else, the user should become familiar with commands X which allow him to select files and display directories. In X directories larger than twenty files, the user should be X able to display each page with the commands given below. X X Command Action X X X ^D :sh Leave _v_s_h. X X a-z Select corresponding file. X X 1-9 Select page 1-9. X X 0 Select the last page. X X + Select next page. X X ^F, ^D Same as +. X X - Select previous page. X X ^U Same as -. X X ^ (Home) Change to home directory. X X / Change to root directory. X X \ Change to previous directory. X X ? Display help file. X X ! Escape to SHELL. X X % Chain to SHELL (does not return to _v_s_h ). X X X XPrinted 6/26/85 3 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X . Find page with files beginning with a cer- X tain character (prompted for). X X $ Escape to the Bourne shell. X X -Line Feed- Change to previous (parent) directory. X X ^L Repaint the display. X XThese are convenience commands. X X D Display date. X X T Display a text file using the _v_s_h pager. X _V_s_h prompts for a file and displays it as X ascii text. This is faster than a selec- X tion which calls the editor. X X P Process status. Call /bin/ps. X X W Who. Display who is logged in. X X X Execute a shell command (prompted for). X X Y Re-execute previous shell command (entered X via X ). X XThese are advanced commands. X X F Select file by name. _V_s_h prompts for a X file name. _V_s_h then selects the specified X file. X X C Create a new file. _V_s_h prompts for a file X name and file type. One may create text X files and directories. One may also copy, X rename and link from existing files. X X L Long format file listing. Next to each X file, _v_s_h displays protection information X in the same manner as _l_s(1). X X O Option listing. The contents of command X and parameter tables are displayed. _V_s_h X then prompts for commands which modify X parameters and which create, modify, and X delete commands. X XREMOVE MODE X Press R to enter _R_e_m_o_v_e _m_o_d_e. In _R_e_m_o_v_e _m_o_d_e, selecting a X file causes it to be marked for removal with two slashes, X "//." Files selected a second time are unmarked. Pressing R X X X XPrinted 6/26/85 4 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X a second time causes all marked files to be removed. The X following commands are available in _R_e_m_o_v_e _m_o_d_e: X X Command Action X X X -Return- Exit _R_e_m_o_v_e _m_o_d_e with out removing marked X files. X X ^D Same as -Return- X X a-z Select corresponding file for removal. X X * Select all files on current page for remo- X val. X X 0-9, +, - Select and display another page. These X commands are described earlier in the X manual in the section on directory opera- X tions. X X ? Display help file. X X R Remove marked files and exit _R_e_m_o_v_e _m_o_d_e. X If _v_s_h cannot remove a file, _v_s_h displays X the reason and waits for a response. X Press -Return- to continue removing marked X files. Press ^D to immediately exit from X _R_e_m_o_v_e _m_o_d_e. X XMAKE, GREP, AND SHOWFILE X _V_s_h interfaces to _m_a_k_e(1) and _g_r_e_p(1). _V_s_h saves output X from these programs and allows one to examine the results in X _s_h_o_w_f_i_l_e _m_o_d_e. From the directory page, the following com- X mands control _m_a_k_e, _g_r_e_p, and _s_h_o_w_f_i_l_e. X X X G _g_r_e_p(1). _V_s_h prompts for a pattern and X file names, and then run _g_r_e_p with these X parameters. The results are saved in the X file ._g_r_e_p_o_u_t and displayed in X _s_h_o_w_f_i_l_e _m_o_d_e. X X S Show previous _g_r_e_p. The output of the last X _g_r_e_p is displayed in _s_h_o_w_f_i_l_e _m_o_d_e. X X M _M_a_k_e(1) _V_s_h runs _m_a_k_e. Execution is con- X trolled by the _m_a_k_e_f_i_l_e in the current X directory. Output is both displayed on X the screen and saved in the file ._m_a_k_e_r_- X _r_o_r. When _m_a_k_e terminates, _v_s_h displays X ._m_a_k_e_r_r_o_r in _s_h_o_w_f_i_l_e _m_o_d_e. X X X XPrinted 6/26/85 5 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X N _m_a_k_e(1) running independently. _M_a_k_e is X run but _v_s_h does not wait for termination. X Output is saved in ._m_a_k_e_r_r_o_r, but is not X displayed on the screen. When _m_a_k_e ter- X minates, the bell on your terminal rings X twice. Use the E command to review the X output in ._m_a_k_e_r_r_o_r. X X E Review errors. The results of the last X _m_a_k_e are displayed in _s_h_o_w_f_i_l_e _m_o_d_e. X XSHOWFILE MODE X _S_h_o_w_f_i_l_e displays the results of a _m_a_k_e or _g_r_e_p. It is X called by the E and S commands. _S_h_o_w_f_i_l_e is called automat- X ically in the course of an M or G command. _S_h_o_w_f_i_l_e is X essentially a special editor. It has commands which allow X one to display a file. One can also command _s_h_o_w_f_i_l_e to X examine a line of the file. _S_h_o_w_f_i_l_e scans this line and X attempt to extract a file name and line number. _S_h_o_w_f_i_l_e X then runs the editor, starting it at the specified line. X X These are the _s_h_o_w_f_i_l_e commands. It is not necessary to X press -Return- after these commands. When a complete com- X mand is sensed, it is run immediately. X X Command Action X X X number p Print file starting at specified line. X X number e Examine line for a file name and line X number. If a file name is found, run the X editor on this file. X X -Return- Display next twelve lines. X X number -Return- Same as number e X X ^D Leave _s_h_o_w_f_i_l_e. X X q Leave _s_h_o_w_f_i_l_e. X X ? Display help file. X X All commands from the directory page which might be useful X are available in _s_h_o_w_f_i_l_e _m_o_d_e. They include ^, /, !, and A X through Z except L and R. Particularly useful are M and G X which allow new iterations of _m_a_k_e and _g_r_e_p, !, the escape X to the shell, and F, which allows one to edit files not X found in the file being shown. X X X X X XPrinted 6/26/85 6 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X XCONTROL COMMANDS X The operation of _v_s_h is controlled by its parameter and com- X mand tables. The contents of these tables can be displayed X via the O command. These tables can be modified with con- X trol commands. When _v_s_h is invoked, it searches for the X file ._v_s_h_r_c in your home directory. Control comands are X then read from this file, allowing one to create a personal- X ized environment. The O command also prompts for control X commands, allowing for interactive modification of the X tables. X X These control commands should be presented in the same lexi- X cal grammar as shell commands. Spaces and tabs separate X tokens. Unquoted newlines terminate each statement. A X character may be quoted by preceding it with a \. All char- X acters inside single quotes (' ') are quoted except the sin- X gle quote. Inside double quotes (" "), \ quotes another X double quote and \newline is ignored. Grave accents (` `) X are treated as any other character. The lexical grammar is X compatible with that of _s_h(1). The grammar is somewhat dif- X ferent from that of _c_s_h(1). X X To change a parameter, use the following format in ._v_s_h_r_c or X to the O command: X X PARAMETER-NAME PARAMETER-VALUE X X PARAMETER-NAME can be any of the following: X X X Parameter Usage X X X EDITOR Preferred editor. Default is _v_i. X X HOME Home directory. Default is $HOME. X X TERM Terminal type. X X PATH Command search list. Default is $PATH. X X SHELL Shell for escapes. Default is $SHELL. X X MAIL File to check for new mail. Default is X /usr/spool/mail/$USER or $MAIL. X X make Make program. Default is /_b_i_n/_m_a_k_e. X X makerror File for error output of make. Default is X .makerror . X X grep grep program. Default is /_b_i_n/_g_r_e_p. X X X XPrinted 6/26/85 7 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X grepout File for output of grep. Default is X .grepout . X X quitchar Character command to leave _v_s_h. Default is X _c_o_n_t_r_o_l-_D. quitchar is expressed as the X desired ASCII character plus octal 0100. X Thus _c_o_n_t_r_o_l-_D is expressed as D and X _e_s_c_a_p_e is expressed as [. X X pagechar An alternate character command for '+', to X advance the file display. pagechar is X also expressed as the desired ASCII char- X acter plus octal 0100. Default is ';' X which is expressed as '{'. X X rmhelp Remove mode help file. Default is X /usr/lib/vsh/rmhelp. X X showhelp Show mode help file. Default is X /usr/lib/vsh/showhelp. X X vshmode _V_s_h operating mode. Default is _e_n_t_e_r. In X _e_n_t_e_r_m_o_d_e, _v_s_h immediately enters a X selected file. The other alternative is X _s_e_l_e_c_t_m_o_d_e, in which _v_s_h places an arrow X beside the selected file and waits for X another key press to determine the opera- X tion to perform on the selected file. X X entertext Determine how _v_s_h should enter text files. X The default is $_E_D_I_T_O_R where _v_s_h invokes X $_E_D_I_T_O_R on the text file. Another alterna- X tive is _d_i_s_p_l_a_y, where _v_s_h invokes the X internal text pager (similar to _m_o_r_e(_1) ) X on the text file. If entertext is neither X of these two alternatives, its value is X interpreted as a program name which should X be invoke on the text file. X X helpfile File name of a help file to display on the X right side of the screen. Default is X $HOME/.vshelp . If helpfile is not defined X or the named file non-existant, no help X menu is displayed. X X window Number of screen lines to use for the file X display. The default is the entire screen X up to 26+4 lines. X X column Number of columns of files to use in the X file display. The default is one. Each X column occupies 19 spaces - thus an 80 X X X XPrinted 6/26/85 8 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X column screen can have at most four X columns. It is permissible to specify more X columns than possible. X X noargprompt If defined, causes _v_s_h to ignore missing X arguments when executing commands. Default X is to prompt for missing arguments. X X VImotion Use _v_i(_1) style cursor motions _h_j_k_l to X move the select pointer around the file X display. Pre-empts the meaning of _h_j_k_l as X file letter selectors and only meaningful X when vshmode is _s_e_l_e_c_t. X X moresize Set memory size for the _v_s_h internal X pager. Default is 10000. Governs amount of X text which can be scrolled through in X reverse. X X enterpath List of directories to search for a file X entered via the _v_s_h file command (default X bound to F ). Default is ':', just the X current directory. X X X To define a command, use the following format in ._v_s_h_r_c or X to the O command: X X CHARACTER KEYWORD [PARAMETERS ...] X X CHARACTER is the character which calls the new command. X Valid characters are ! " # $ % & ' ( ) : * = ^ ~ [ ] { } < > X , . / ? and A-Z. X X These are the valid keywords: X X Keyword Purpose X X X date Display date. X X showerror Show errors from previous _m_a_k_e. X X showgrep Show output from previous _g_r_e_p. X X file Select a file. If parameter is present, X the parameter is selected. Otherwise, _v_s_h X will prompt for a file name. X X home Change to home directory. X X grep Run _g_r_e_p. _V_s_h will prompt for parameters. X X X XPrinted 6/26/85 9 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X wmake Run _m_a_k_e. Wait for termination. X X fmake Run _m_a_k_e. Do not wait for termination. X X remove Enter _R_e_m_o_v_e _m_o_d_e. X X longlist Print long format listing of files on the X current page. X X display Display the contents of a file. If no X parameter is present, _v_s_h will prompt for X a file name. X X options Display _v_s_h options (parameter and command X tables). Accept commands which modify X parameters and which create, modify, and X delete commands. X X exec Execute a program directly with the exec X system call. The first parameter must be X the program name. Directories are not X successively searched as in the shell. X Any other parameters become parameters to X the program. If it is necessary to X redirect files, to expand macros, or to X expand file regular expressions, use the X shell or xecute keyword instead. X X pexec Like exec but the command's output is pro- X cessed through the _v_s_h internal pager X (similar to _m_o_r_e(_1) ). X X shell If no parameter is present, an interactive X shell is spawned. If one parameter is X present, it is passed to the shell and run X as a command. Do not specify more than X one parameter. Instead, enclose the X entire shell command in quotes to provide X _v_s_h with only one parameter. X X create _V_s_h prompts for a new file name. The file X is created. If the file already exists, X create will refuse to overwrite it unless X a ! precedes the file name. X X xecute Execute one shell command (like shell ), X prompt if no command is given. X X rexecute Re-execute previous xecute command. X X chain Chain (exec without fork) to a new command X (never returns to _v_s_h ). X X X XPrinted 6/26/85 10 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X null Undefines a command. X XADVANCED USAGE XSELECT MODE X The default mode for _v_s_h described above is called _e_n_t_e_r_- X _m_o_d_e. In this mode, files are _e_n_t_e_r_e_d immediately upon X selection via a single keypress of _a-_z. The operation per- X formed on the selected file is determined by the file type. X _V_s_h has another, more advanced mode of operation, X _s_e_l_e_c_t_m_o_d_e. This mode is enabled when the parameter vshmode X is set to _s_e_l_e_c_t. When _v_s_h is in _s_e_l_e_c_t_m_o_d_e, two keypresses X are required to initiate an operation. The first, as in X _e_n_t_e_r_m_o_d_e, selects the desired file, _a-_z. An arrow appears X next to the file selected. The second keypress then deter- X mines the operation to be performed on the selected file. If X the same file (keypress) _a-_z or ` or _c_a_r_r_i_a_g_e _r_e_t_u_r_n is X chosen, the file is _e_n_t_e_r_e_d in a manner identical to _e_n_t_e_r_- X _m_o_d_e, i.e. based on file type. If another file _a-_z is X selected, that file becomes the current selected file, and X the arrow appears next to that file instead. If a command X character is pressed ( _A-_Z, or others), that command is X invoked and the selected file is available as an argument to X that command. Whether the invoked command actually uses the X selected file or not depends on whether the command was X defined to use it. X X The following predefined commands (see above) are interfaced X to _s_e_l_e_c_t_m_o_d_e, X X Keyword Effect X X X display Display the contents of the selected file. X X create Create a new file. The selected file may X be used for rename, copy or link opera- X tions. X X The following commands are interfaced to _s_e_l_e_c_t_m_o_d_e by the X token $ which is replaced by the name of the selected file. X X grep Search for pattern in named file(s). The X named file may be '$' which specifies the X selected file. Wherever a $ token appears X in a command definition using the follow- X ing program execution keywords, it is X replaced by the name of the selected file. X X exec Execute a program. X X pexec Like exec but filters the standard output X through the _v_s_h internal pager (similar to X X X XPrinted 6/26/85 11 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X _m_o_r_e(_1) ). X X xecute Execute one shell command (like shell ), X prompt if no command is given. X X rexecute Re-execute previous xecute command. X X Thus to define the letter _v as a command to invoke /_b_i_n/_v_i X on a selected file, one types X X v exec /bin/vi $ X X to the _o_p_t_i_o_n_s command, or in ._v_s_h_r_c In addition, for exec X and pexec, each argument beginning with ?? is printed as a X prompt message and a string is obtained from the terminal to X place that argument. X XMULTICOLUMN DISPLAYS X Instead of a single column of files per screen, _v_s_h can X display multiple columns of files each column corresponding X to a _v_s_h page. This type of display is not compatible with X the help menu display enable by the helpfile parameter. Mul- X ticolumn displays are enabled by setting the parameter X column to the number of desired columns. Each occupies 19 X spaces. _E_m_a_c_s cursor commands are available to move the X _s_e_l_e_c_t_m_o_d_e arrow around the multicolumned file display. The X _v_i commands hjkl are also available but the option VImotion X should be set to avoid conflict with the _a-_z interpretation X of these keys in file selection. X XINTERNAL PAGER X _V_s_h has an internal pager similar to _m_o_r_e(_1) that is used X with the display and pexec commands. The following commands X are available when in the pager. X X 1,< Go to the first line. X X G,> Go to the last line. X X ?,^R Reverse search X X /,^S Forward search X X e,v Invoke $EDITOR X X -,^P,k Previous line X X <CR>,^N,j Next line X X ^U Previous half page. X X ^D Next half page. X X X XPrinted 6/26/85 12 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X ^B,^ Previous full page. X X ^L Repaint screen. X X ! Fork a subshell. X X (_a_n_y_t_h_i_n_g _e_l_s_e) Next full page. X X The forward and reverse searches prompt for a string pattern X which supports only the ^ . $ regular expression operators. X A forward search can cause a file to hit EOF. In this case, X the wraparound can fail if the more buffer size is insuffi- X cient to hold the entire file (see the parameter moresize ). X Reverse searches do not wraparound. If no pattern is X entered, the previous pattern is used. X XHINTS X When typing in a file name (e.g. to the file command), ! X means the last file name typed in. X X If the program name invoked by exec or xecute begins with ; X the screen is updated immediately after the program ter- X minates. This feature facilitates screen/command interac- X tions (i.e. cleans up the screen and doesn't slow you down). X X A ~ in the beginning of a file name is replaced with a X user's login directory, as in _c_s_h(_1). X X It is generally preferable to use _s_e_l_e_c_t_m_o_d_e and define X entertext as _d_i_s_p_l_a_y. Used this way _v_s_h can speedily examine X the contents of text files without the overhead of invoking X a separate editor. Use the invoke editor command within the X pager to invoke an editor and also define a separate command X which invokes your favorite editor on a selected file. X X The best way to change directories is with the file keyword. X It is particularly efficient to bind file to / since / often X appears at the beginning of pathnames and is usually a non- X shifted key. X X The _v_s_h display works best with terminals that support the X _t_e_r_m_c_a_p CS capability (change scrolling regions). All VT100 X emulators and other ANSI-like terminals should have this X feature. With the CS capability, it is then optimal on a X 80x24 terminal to set window to 11 (a-g plus two lines each X on top and bottom). Then one can use the _v_i hjkl without X ambiguity and have a reasonably large pager region. With X larger VT100-like terminals, such as the CIT-500 and the X Bitgraph, one can set window to as large as 30 (26 + 4). X X Using the O command for changing options and parameters is X best for making temporary changes to the configuration for X X X XPrinted 6/26/85 13 X X X X X X XVSH(1) UNIX Programmer's Manual VSH(1) X X X X _v_s_h. When making permanent changes to one's _v_s_h configra- X tion, it is best to alter ._v_s_h_r_c. It is convenient to define X a _v_s_h command to chain to _v_s_h itself. Then to make a per- X manent change to the _v_s_h configuration, one simply edits X ._v_s_h_r_c and then uses the chain to _v_s_h to overlay the current X _v_s_h with one which has read in the new ._v_s_h_r_c. X XFILES X $HOME/.vshrc initialization file. X /etc/termcap terminal capability database necessary X for addressing cursor. X /bin/pwd for determining the path name of the X working directory. X /dev/null data sink. X /usr/lib/vsh/* supporting documentation and help files. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XPrinted 6/26/85 14 X X X All work and no play makes Jack a dull boy exit