[comp.unix.questions] VI questions

zhao@csd4.milw.wisc.edu.UUCP (10/03/87)

Just a couple of quick questions

1. I would like to disable the bells in VI ( caused , say, by two Esc),
seems that 'set noerrorbells' doesn't stop the bell. What is the
problem? If two Esc are not considered an error why ring the bell in the
first place ? Am I missing something ?

2. I remember a while back someone mentioned ' visual bells' in Vi,
that is instead of a bell the screen flashes should an error occur.
Can someone tell me how to do this ?

Any help is greatly appreciated.
----------------------------------------------
ARPA:        zhao@csd4.milw.wisc.edu     
BITNET       zhao%csd4.milw.wisc.edu@wiscvm.bitnet
UUCP         uwmcsd1!csd4!zhao

karel@dutesta.UUCP (Karel van Houten) (10/05/87)

In article <3050@uwmcsd1.UUCP> zhao@csd4.milw.wisc.edu.UUCP (T.C. Zhao) writes:
>
>2. I remember a while back someone mentioned ' visual bells' in Vi,
>that is instead of a bell the screen flashes should an error occur.
>Can someone tell me how to do this ?

This has to be defined in the TERMCAP (file or environment variable).
Below is my entry for a CIT101 terminal. When you want to put
these commands in a file, don't forget you must use 'source file...',
otherwise the environment of the subshell will be set only.
Please note the 'vb' entry, This will reverse the screen, send some NULLs,
and reverse it again.

setenv TERM cit101n
setenv TERMCAP 'd1|cit101n:al=\E[L:\
	:am:bs:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:co#80:\
	:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:ei=:ic=\E[@:im=:kd=\E[B:\
	:kl=\E[D:kr=\E[C:ku=\E[A:li#24:nd=\E[C:pt:se=\E[m:so=\E[1m:\
	:ue=\E[m:up=\E[A:us=\E[4m:\
	:vb=\E[?5h\200\200\200\200\200\200\200\200\200\200\200\200\E[?5l:\
	:xn:xv:k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:k4=\EOw:k5=\EOx:k6=\EOy:\
	:k7=\EOm:k8=\EOt:k9=\EOu:l0=PF1:l1=PF2:l2=PF3:l3=PF4:sf=\ED:\
	:sr=\EM:vs=\E[5v\E\=:ve=\E[4v\E>'

-- 
Karel van Houten                       BITNET   : NO! NO! NO!
Delft University of Technology         INTERNET : karel@dutesta.UUCP
Faculty of Electrical Engineering      UUCP     : ..!mcvax!dutrun!dutesta!karel
Room 9.29H, Mekelweg 4                 SURFnet  : DUTRUN::KAREL
2628 CD  DELFT, The Netherlands        VOICE    : +31 15 783502

irf@kuling.UUCP (Stellan Bergman) (10/07/87)

In article <3050@uwmcsd1.UUCP> zhao@csd4.milw.wisc.edu.UUCP (T.C. Zhao) writes:
>Just a couple of quick questions
>
>1. I would like to disable the bells in VI ( caused , say, by two Esc),
>seems that 'set noerrorbells' doesn't stop the bell. What is the
>problem? If two Esc are not considered an error why ring the bell in the
>first place ? Am I missing something ?
'vi' does not only communicate by writing (admittedly, not very much unless
programmed otherwise) on the screen but also by sounding the bell. ESC ESC
is a safe way of *always* getting into the command mode.  The experienced
typist relies on the audial signal from 'vi' to confirm this and doesn't
have to use his/her eyes.  Hence, the 'vi' bell is *not* to be considered
an error indication only! 
>2. I remember a while back someone mentioned ' visual bells' in Vi,
>that is instead of a bell the screen flashes should an error occur.
>Can someone tell me how to do this ?
In your terminfo (or termcap) file you add a 'flash' entry (e.g. escape
sequences to temporarily change the screen to reverse video and back) and in
your EXINIT (or .exrc file if you use such a thing) you do :set flash.
In 'vi' you can disable flashing by :set noflash.  The side effect is
that the terminal will be initiated by your 'tset' to flash instead
of sounding the bell to indicate errors also in your shell.  Personally
I use flash all the time.  It is *much* nicer to the guys in the offices
next door ...

gwyn@brl-smoke.ARPA (Doug Gwyn ) (10/10/87)

In article <504@kuling.UUCP> irf@kuling.UUCP (Stellan Bergman) writes:
>In article <3050@uwmcsd1.UUCP> zhao@csd4.milw.wisc.edu.UUCP (T.C. Zhao) writes:
>>2. I remember a while back someone mentioned ' visual bells' in Vi,
>In your terminfo (or termcap) file you add a 'flash' entry (e.g. escape

The termcap name for this string capability is "vb"; the terminfo name
is "flash".  Warning: usually, such entries assume that your terminal
is operated in a particular B-on-W or W-on-B state; if you use reverse
video when that's the opposite of what the termcap/terminfo entry
assumes, the first visual bell will toggle your B/W mode.