*BSD News Article 66598


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!newsfeed.internetmci.com!newsxfer2.itd.umich.edu!agate!sunsite.doc.ic.ac.uk!lyra.csx.cam.ac.uk!uknet!uknet!yacc.co.uk!chris
From: chris@yacc.co.uk (Chris Davies)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Silly but annoying vi question
Date: 19 Apr 1996 11:25:38 GMT
Organization: yacc labs, Leeds, UK
Lines: 47
Message-ID: <4l7t7i$enp@incy-wincy.yacc.co.uk>
References: <4knefr$n34@cronkite.ocis.temple.edu>
NNTP-Posting-Host: fergie.yacc.co.uk
X-Newsreader: TIN [version 1.2 PL2]

Mary Kingston (mary@thunder.ocis.temple.edu) wrote:
: I am having what I can only describe as a very silly problem
: working in VI on my BSDI 2.1 system.  My cursor keys won't 
: reposition the cursor when I am in command mode.  Instead,
: they insert the "A", "B", "C", or "D" character from the
: arrow escape sequence into the file.  

Works fine for me  :-)

It depends on the terminal type definition that you're using.  If
you're using the console (or one of the console virtual terminals)
in text mode then the default setting of "ibmpc3" should be fine.

If you're using another terminal via a serial line or network (or
an xterm, for that matter) you'll need to check that the terminal
definition understands what to do with the cursor key sequences.

One way to do this is to "echo $TERM" and then page down through
/etc/termcap looking for a matching entry.  (Entry names are defined
at the start of each section.)

For example, ibmpc3 is defined as,

ibmpc3|pc3-bold|IBM PC BSD/386 Console with bold instead of underline:\
	:us=\E[1m:ue=\E[0m:tc=pc3:

The tc= says look at the pc3 entry, too...

pc3|IBM PC BSD/386 Console:\
	:li#25:co#80:am:bs:bw:eo:\
	:al=\E[L:Al=\E[%dL:bl=\007:cd=\E[J:ce=\E[K:\
	:cl=\Ec:cm=\E[%i%d;%dH:dl=\E[M:DL=\E[%dM:do=^J:DO=\E[%dB:ho=\E[H:\
	:kH=\E[F:kI=\E[L:kN=\E[G:kP=\E[I:kd=\E[B:kh=\E[H:kl=\E[D:km:kr=\E[C:\
	:ku=\E[A:le=^H:LE=\E[%dD:mb=\E[5m:md=\E[1m:me=\E[0m:\
	:mh=\E[=8F:mr=\E[7m:nd=\E[C:pt:rc=\E8:RI=\E[%dC:sc=\E7:se=\E[0m:\
	:so=\E[7m:up=\E[A:UP=\E[%dA:

The important bits are the ku= kd= kl= and kr= which define the
key sequences sent by the up, down, left and right cursor keys
respectively.  Without these your UNIX box won't know what to do
with them.  Since, on many systems, cursor movement starts with an
ESCAPE, vi tries to execute the "command" letters that follow...
so you end up getting strange things happening.

Chris
--
yacc Labs, Leeds, UK.  (tel +44 113 287-2381, email chris.davies@yacc.co.uk)