[net.followup] HP2621P Function Keys

mdb@ihuxq.UUCP (Mark Brukhartz) (12/16/83)

Your function keys are not programmable. They stubbornly insist
on generating escape sequences (ESC-q through ESC-w) and sending
them in "transmit" mode (followed by a CR). The only 2621-series
terminal with programmable function keys is the 2621B (which has
an optional printer, although its name doesn't reflect that).

All is not lost. Vi can be programmed to recognize arbitrary escape
sequences via its "map" command.

Set your 2621P's "G" and "H" configuration straps, disable the "E"
handshake mode and enable "X" handshaking. This will stop various
funny forms of ENQ-ACK handshaking, which are not supported by Unix.

Now use the vi "map" command to translate your function keys into
editing commands. You'll need vi's ^V transparent escape to enter
various control characters (such as ESC and CR) into the command.
For example, type ":map ^V^[q^V^M dd" to map the f1 key into a
delete line command (where ^V is control-V, ^[ is ESC and ^M is
CR).

You can also place "map" commands in your .exrc file (or EXINIT
environment variable), where they will be automagically executed
every time you invoke ex or vi. You don't need actual ^V escapes
in .exrc (although you'll need ^V to put the necessary control
characters into the file in the first place).

Good luck, and may the (electromotive) Force be with you.

				Mark Brukhartz
				ihnp4!ihuxq!mdb

stevens@inuxh.UUCP (12/16/83)

>	You can also place "map" commands in your .exrc file (or EXINIT
>	environment variable), where they will be automagically executed
>	every time you invoke ex or vi. You don't need actual ^V escapes
>	in .exrc (although you'll need ^V to put the necessary control
>	characters into the file in the first place).

If you put map commands in your .exrc file, and the map commands contain
control characters, make sure the beautify option (bf) isn't set until
*after* the map commands; otherwise, the control characters will be
stripped out of the map commands. 

--
Scott Stevens
AT&T Consumer Products Laboratories
Indianapolis, Indiana
UUCP: inuxh!stevens

mark@cbosgd.UUCP (12/16/83)

It is preferred to use the function key notation, rather than putting
the particular escape sequences your 2621 sends into your .exrc.
That is, instead of
	map ^V^[q^V^M dd
use
	map #2 dd
(because the escape q cr key is F2).  This avoids putting escape
sequences in your file, and it also means your F2 key will work the
next time you use something other than a 2621.  Also, the beautify
problem mentioned earlier does not apply to the EXINIT environment
variable, which is preferred anyway because vi will start up faster.

By the way, if it's really vi you want to extend, it's usually easier
to load up some of the unused characters (yes, Virgina, there are a
few keys that don't do anything in vi) instead of depending on function
keys that are in different places, if at all, on your keyboard.
(Especially if you're a 2621 user and don't enjoy holding down shift
to make them work.)  I have permanent macros on my command mode ^O key
and my insert mode ^L key, and usually put temporary macros on my g,
v, and q keys, which are otherwise unused in normal command mode.

mdash@mh3bc1.UUCP (12/20/83)

They are programmable; try looking at a manual.  They will not lock your
keyboard if you have your terminal configured properly.

kdp@hplabs.UUCP (Ken Poulton) (12/20/83)

Someone mentioned that the HP 2621 function keys locked up his terminal.
Same thing happened to me (on my 2623) until I changed some configuration
bits.  In particular, (at least on my '23) there are two datacomm
configuration bits called Inhibit Handshake and Inhibit DC2 which
control block-mode transfer protocols.  These default to NO (softkey menu
configurable on the '23) for HP computers (which have some weird
terminal handshaking).  For most other machines, set them to YES
and no handshaking is done; the function keys' codes are simply sent,
no questions asked.

As for actually using these keys, the map suggestion for vi is about
the best I've heard.  (Unless you can create shell scripts with names
like <ESC>v - maybe that would work in the shell.)
All the more recent versions (2622 on) have real softkeys: you
can program the contents (what is sent to the computer) as well as the label.