[net.sources] vt220 termcap and .randrc file

sloane@noscvax.UUCP (Gary K. Sloane) (08/11/84)

This document describes the setup for a vt220 to work with the enclosed
termcap on 4.2bsd UN*X. The vt220 is operated as a vt100 except when 
the extra function keys are needed. The reason for operating in vt100 
mode is that in vt220 mode the ESC, BS, and LF keys are not operational. 
If desired the termcap could be modified to use the left arrow as a 
backspace key (:kb=\E[D:) and then run in vt220 mode, but it's nice 
to be able to use the ESC key when required. 

If you are a RAND editor user and if you choose to use the vt220 in native
vt220 mode, the .randrc file provided will have to be modified to not 
reset the vt220 to vt100 mode after the edit session is ended. 
(More about the .randrc later).

-------------------------------------------------------------------------
SETTING UP THE TERMINAL:

Setup the vt220 as follows using the set-up menus on the terminal:

        DISPLAY:        80 columns
                        Interpret Controls
                        Auto Wrap
                        Cursor (gotta see it)

        GENERAL:        VT100 mode
                        VT100 ASCII
                        User Defined Keys Unlocked
                        User Defined Features Unlocked
                        Numeric Keypad
                        Normal Cursor Keys
                        No New Line

          COMM:         7-bit EVEN PARITY (this is a must if you wish to
			use the RAND editor with the provided .randrc file.
			If you will not be switching into vt220 mode, then
			7 or 8 bit any parity is ok. I use 7-bit EVEN all
			the time and have no problems (4.2bsd unix on a VAX))

      KEYBOARD:         Auto Repeat
                        Break
                        No Answerback

These options are required - the ones not listed are up to the user's
discretion.

-------------------------------------------------------------------------
SETTING UP THE TERMCAP:

Now the termcap (one entry per line to make it easier to understand):

#DEC vt220 TERMCAP for terminal operating in vt100 mode
#The terminal must use EVEN parity and 7-bit word to us the RAND editor
# with the attached .randrc file
#Written by Gary Sloane (sloane@nosc) MAY 1984
dv|vt220:\
        :ae=4\E(B:\
        :am:\
        :as=2\E(<:\
        :bs:\
        :cd=50\E[J:\
        :ce=3\E[K:\
        :cl=50\E[H\E[2J:\
        :cm=10\E[%i%d;%dH:\
        :co#80:\
        :cr=^M:\
        :cs=\E[%i%d;%dr:\
        :dc=1\E[P:\
        :dl=1\E[M:\
        :do=^J:\
        :ei=\E[4l:\
        :ho=\E[H:\
        :if=/usr/lib/tabset/vt131:\
        :im=\E[4h:\
        :is=\E[1;24r\E[H\E[2J:\
        :k0=\E[1~:\
        :k1=\E[2~:\
        :k2=\E[3~:\
        :k3=\E[4~:\
        :k4=\E[5~:\
        :k5=\E[6~:\
        :k6=\EOP:\
        :k7=\EOQ:\
        :k8=\EOR:\
        :k9=\EOS:\
        :kb=^H:\
        :kd=\EOB:\
        :ke=\E[?1l\E>:\
        :kl=\EOD:\
        :kr=\EOC:\
        :ks=\E[?1h\E=:\
        :ku=\EOA:\
        :le=^H:\
        :li#24:\
        :nd=2\E[C:\
        :nl=^J:\
        :pt:\
        :rc=\E8:\
        :rf=/usr/lib/tabset/vt100:\
        :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
        :sc=\E7:\
        :se=2\E[m:\
        :so=2\E[7m:\
        :sr=5\EM:\
        :ta=^I:\
        :ue=2\E[m:\
        :up=2\E[A:\
        :us=2\E[4m:\
        :vt#3:\
        :xn:

The termcap sets up the vt220 as a vt100 with automatic margins, and
assumes that the terminal is setup (as described above).

----------------------------------------------------------------------------
SETTING UP THE RAND EDITOR STARTUP FILE (RAND editor users only):

The following .randrc file allows the vt220 to be used as a suitable
workstation for the RAND editor. The keystrokes are set up to look
like WORDSTAR with the exception of the CTRL-Q sequences. The vt220
operates as a *true* vt220 while in a RAND session, with the terminal
being switched back to vt100 mode at exit. The reason for running in
vt220 mode is that all the function keys are available, while in vt100
mode they are not. Since the vt220 plays games with CTRL-Q (x-on) it
is necessary to map all RAND sequences to function keys if you want them
to work. The CTRL-Q/CTRL-S keyins do what they should - start and stop
the screen display. By looking at the .randrc you should be able to see
what keys are mapped to what RAND functions. If you are not used to
using a .randrc to make the editor look like WORDSTAR, then you probably
won't want this .randrc. The first two characters of the .randrc (in this
case 'dv') must match the first two characters of the termcap file - if you
change the termcap file at installation time, you must change the .randrc
file. Here goes:

#RAND editor sartup file - maps the basic functions to emulate wordstar
#keyins, and maps the ctrl-Q sequences to the vt220 function keys, as the
#vt220 acts as a ctrl-Q black hole and doesn't pass them on... This
#.randrc is designed for a vt220 setup to operate in vt100 mode. On
#RAND editor startup the vt220 is toggled into native vt220 mode to allow
#use of the function keys. Upon exit from the editor, the terminal is
#restored to vt100 mode. 
#written by Gary K. Sloane (sloane@nosc) MAY 1984
dv vt220  VT220 
instring = \[[62;1"p\[>\[[?3l\[[?4l\[[?5l\[[?7l\[[?8h
end string = \[[61"p\[>\[[?7h
auto margin = 3
.
^A:\207;                back word tab
^B:\177;                ignore in this section
^C:^Y;                  plus page
^D:^_;                  cursor right
^E:^N;                  cursor up
^F:\206;                word tab
^J:\177;                multi sequence
^K:\177;                multi sequence
^L:\277;                ignore control L
^N:\177;                ignore in this section
^O:\177;                ignore control O
^P:\034;                quote
^Q:\177;                multi sequence (replaced by function keys)
^R:^Q;                  neg page
^T:\204;                delete word
^U:^C;                  interrupt
^V:^O;                  insrt/del toggle
^W:^W;                  back 10 lines
^X:^J;                  cursor down
^Y:^F;                  close line
^Z:^T;                  forward 10 lines
^[:\177;                multi sequence
.
^B:^@just^M^@\034^J\034^J^R;   justify
^J^E^F:\202;            refresh
^J^E^S:\201;            restore
^J^F:^E;                neg find
^J^G:^X;                goto
^J^L:\205;              display line
^J^O:^D;                open
^J^P^I:^L;              pick
^J^P^U:\200;            put
^J^R:^B;                change file
^J^T:^];                back tab
^J^W^C:^Z;              change window
^J^W^L:^A;              window left
^J^W^R:^S;              window right
^J^Z:^^;                back delete
^K^B:^G;                set mark
^K^D:^@ex^M;            also normal exit
^K^H:\203;              remove mark
^K^Q:^@-upd^M^@ex^M;    no update exit
^K^R:^B;                change file
^K^S:^@save redtemp^M;  save in file redtemp
^K^X:^@ex^M;            normal exit
^N:^@split^M;           insert a carriage return
^O^C:^@center^M;        center this line
^O^I:^[;                tab set
^O^N:^@^[;              tab clear
^[S:^@;                 command
*\[[A:\n;               move up
*\[[B:\j;               move down
*\[[D:\h;               move left
*\[[C:\_;               move right
*\[[1~:^X;              FIND: goto line
*\[[2~:\206;            INSERT: fwd word
*\[[3~:\207;            REMOVE: bwd word
*\[[4~:^P;              SELECT: replace
*\[[5~:^Q;              PREV SCREEN: previous page
*\[[6~:^Y;              NEXT SCREEN: next page
*\[OP:^U;               PF1: delete character  
*\[OQ:\204;             PF2: delete word
*\[OR:^F;               PF3: delete line
*\[OS:^@^U;             PF4: delete to end-of-line
*\[[17~:^D;             F6: open
*\[[18~:^F;             F7: close
*\[[19~:\201;           F8: paste
*\[[20~:^R;             F9: fwd search
*\[[21~:^E;             F10: minus search
*\[[23~:^G;             F11: mark
*\[[24~:^L;             F12: pick
*\[[25~:\200;           F13: put
*\[[26~:\203;           F14: remove mark
*\[[28~:\202;           HELP: refresh
*\[[29~:^@;             DO: command
*\[[31~:^K;             F17: home cursor
*\[[32~:^@^J;           F18: screen bottom
*\[[33~:^@^H;           F19: line start
*\[[34~:^@^_;           F20: line end
..

----------------------------------------------------------------------------
Well, folks, that's it. If you have *ANY* comments, fixes, changes, etc.
or you don't understand what I said, *PLEASE* contact me via mail and
talk to me.


      Gary K. Sloane
      Computer Sciences Corporation
      c/o Naval Ocean Systems Center
      COTD Building 1 Room B205
      San Diego, California 92152

      MILNET: sloane@nosc
      UUCP:   ...{sdcsvax}!noscvax!sloane
      DDD: (619) 225-8401 x391

PS:  RAND, UNIX, WORDSTAR, and 4.2bsd are all registered trademarks...
PPS: This documentation is explicitly donated to the public domain
	except where it would infringe on applicable copyrights.
PPPS: The usual waiver of liabilities on usage apply... 


    * **************************************************************** *
    * Gary K. Sloane/Computer Sciences Corporation/San Diego, CA 92110 *
    * DDD: (619) 225-8401                                              *
    * MILNET: sloane@nosc                                              *
    * UUCP: [ihnp4,akgua,decvax,dcdwest,ucbvax]!sdcsvax!noscvax!sloane *
    * **************************************************************** *
-- 
    * **************************************************************** *
    * Gary K. Sloane/Computer Sciences Corporation/San Diego, CA 92110 *
    * DDD: (619) 225-8401                                              *
    * MILNET: sloane@nosc                                              *
    * UUCP: [ihnp4,akgua,decvax,dcdwest,ucbvax]!sdcsvax!noscvax!sloane *
    * **************************************************************** *