Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!rpi!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!csn!boulder!spot.Colorado.EDU!cook From: cook@news.colorado.edu (Richard L. Cook) Newsgroups: comp.unix.ultrix Subject: Re: vt240 & termcaps / escape key problems Message-ID: Date: 28 Jun 91 15:06:51 GMT References: Sender: news@colorado.edu (The Daily Planet) Reply-To: cook@spot.Colorado.EDU Organization: University of Colorado, Boulder Lines: 62 Nntp-Posting-Host: spot.colorado.edu braun@dri.com (Kral) writes: >We have both VMS and Unix (Ultrix) systems here. One of my people has a vt240 [...] >The problem is, the escape key on the vt240 sends a "]23~", which editors >like vi interpret as a combination of garbage and "change case" commands; the The question of how to get around this has been answered (use Setup to switch the terminal to VT100 mode or just use ^[ for escape -- the latter is what I usually suggest that people do), but I thought a bit more detail and an alternative solution might be of interest. The combination of `^[' (ie, the escape key) and `[' (left bracket, not right) on newer DEC terminals (since the VT200 series and the LK201 keyboard) signals the initiation of a Command Sequence and depending on what comes next you can do many strange and wondrous things to your terminal if sent in that direction or signal the use of a special key if sent in the other direction. In the latter case, UNIXen don't know about the special status of F11 (presumably this will change when we get DEC's TPU/EVE for ULTRIX) so F11 gets interpreted as (a) a real escape, (b) a mistake (`[[' goes to the beginning of a section, but `[2' justs gets you beeped), (c) a diversion (the MKS vi on my PC clone would interpret it as a repetition count, but on any UNIX-based vi's I've been able to try this on it gets ignored), and (d) a change case command. So an alternative solution is that if the last character you've typed is alpha just make sure it's the wrong case and go ahead and use F11! Now the purist won't think this is a very elegant solution (and won't like the extraneous beep, either) so another alternative is to make good use of command sequences and to send one to the terminal to tell it to turn itself from gold into lead (don't get me wrong -- I liked my VT100) as in: print -n "[61\"p" I stuck this in a file named VT100 (the `print -n' is from the KornShell, `echo' should work in others), made it executable with `chmod +x vt100', and presto -- I've got a gender-changer, so to speak. (Note that in vi you need to do a ^V to insert the special escape character.) This could go in .profile (the mileage of other shells may vary). To change back I have a file named vt300 which contains: print -n "[63;1\"p" where the 3 would be changed to a 2 for VT200 series terminals and the 1 would be changed to a 0 for 8-bit controls. (In both of these the inner `"' is quoted with `\'.) As it happens, a VT[23]00 terminal retains an appropriate terminal ID so that a SET TERM/INQUIRE on the VMS machine will make the switch automagically. On a PC I have Kermit set up the function keys so that F1 thru F10 map to the VT's F11 thru F20 so that the real escape is right next to the F11 function key. In some ways it's better than being on a Real DEC terminal (I use both as well as both VMS and ULTRIX -- and others). And on the PC I use the MKS toolkit and Digital Research DOS -- which is almost like being on a Real Computer! Richard -- Richard cook@spot.Colorado.EDU | cook@Colorado.BITNET | +1.303.492.2148 Social Science Data Analysis Center, University of Colorado 80309-0486