[net.unix] Defining function keys in vi

sundar@cwruecmp.UUCP (Sundar R. Iyengar) (01/21/84)

	The 'map' command could be used to bind function keys
	on terminals to specialized and customized commands.
	Is it possible to define in .exrc or EXINIT or some
	other files, the bindings such that depending on the
	terminal you are on, the mapped key stroke sequences
	would leave the key stroke sequences meant for another
	terminal unmapped? For instance, VT100 generates
	OP for PF1. Zenith Data Systems generates S for F1.
	When I am on VT100 I would like OP define as a certain
	command, leaving S unmapped. Similarly, when I am on
	Zenith Data Systems, I would like S mapped but OP
	unmapped.

	Thanks

	Sundar Iyengar
	decvax!cwruecmp!sundar
	sundar.Case-Western@Rand-Relay

	Posted: 2:09:27 pm, Saturday January 21, 1984.

gwyn%brl-vld@sri-unix.UUCP (02/05/84)

From:      Doug Gwyn (VLD/VMB) <gwyn@brl-vld>

Termcap (and presumably terminfo) has the ability of defining function
keys, although I don't know of any programs that use this information.

For example, the following is my VT100 termcap entry; k0..k3 are the
definitions of the function key sequences:

#
# DEC VT100
# I assume you have the Advanced Video Option, although this entry works
# okay in its absence (use the "vt100-132x14" entry for non-AVO 132 col.).
# The following SET-UP modes are assumed for normal operation:
#	ANSI_MODE	AUTO_XON/XOFF_ON	NEWLINE_OFF	80_COLUMNS
# Other SET-UP modes may be set for operator convenience or communication
# requirements; they are not modified by this termcap entry.  I recommend
#	SMOOTH_SCROLL	AUTOREPEAT_ON	BLOCK_CURSOR	MARGIN_BELL_OFF
#	SHIFTED_3_#	WRAP_AROUND_ON
# Unless you have a graphics add-on such as Digital Engineering's VT640
# (and even then, whenever it can be arranged!) you should set
#	INTERLACE_OFF
# Although the VT100 can set and clear tab stops, I omitted "ct" and "st".
# Hardware tabs are assumed to be set every 8 columns; they can be set up
# by the "reset" or "tabs" utility (put VT100 in 132-column mode for this).
# Note: "reset" clears the screen as a side-effect of setting # of columns.
# Be sure to use "stty -ixany" (or decctlq) to enable DC3/DC1 flow control!
d0|vt100|DEC VT100:\
	:ae=^O:as=^N:bs:cd=\E[J:ce=\E[K:ch=\r\E[%i%dC:cl=\E[H\E[J:\
	:cm=\E[%i%d;%dH:co#80:cs=\E[%i%d;%dr:DO=\E[%dB:do=\ED:ho=\E[H:\
	:is=\E<\E)0:k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:kb=^H:kd=\EOB:\
	:ke=\E[?1l\E>:kl=\EOD:kn#4:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=PF1:\
	:l1=PF2:l2=PF3:l3=PF4:LE=\E[%dD:li#24:ll=\E[24H:mb=\E[5m:md=\E[1m:\
	:me=\E[m:mr=\E[7m:ms:nd=\E[C:pt:rc=\E8:rf=/usr/lib/tabset/vt100:\
	:RI=\E[%dC:\
	:rs=\E<\E2\E[20l\E[?3;6l\E7\E[1;24r\E8\E[m\E#5\E[q\E(B^O\E)0\E>:\
	:sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ue=\E[m:UP=\E[%dA:up=\EM:\
	:us=\E[4m:vt#3:
d1|vt100-132|DEC VT100 with AVO in 132-column mode:\
	:co#132:\
	:rs=\E<\E2\E[20l\E[?6l\E[?3h\E7\E[1;24r\E8\E[m\E#5\E[q\E(B^O\E)0\E>:\
	:tc=vt100:
d2|vt100-132x14|DEC VT100 without AVO in 132-column mode:\
	:co#132:li#14:ll=\E[14H:\
	:rs=\E<\E2\E[20l\E[?6l\E[?3h\E7\E[1;14r\E8\E[m\E#5\E[q\E(B^O\E)0\E>:\
	:tc=vt100: