[comp.unix.wizards] YAVB - yet another VI bug

dave@astra.necisa.oz (Dave Horsfall) (10/08/87)

A common technique in VI is to use tab stops every 4 columns by using
sw=4 and ^D ^T.  However, after a career of bashing the TAB key, it is
difficult to adjust.

One would think that TAB could be mapped into ^T with "map! ^V^I ^V^T",
but no - it says "Missing rhs".  Obviously, the ^V does not escape white
space.

Is this a bug or a feature?  I don't have VI source, which is probably
just as well - it's been known to drive strong men (& women?) to drink.

-- 
Dave Horsfall  (VK2KFU)        ACS:  dave@astra.necisa.OZ
NEC Information Systems Aust.  ARPA: dave%astra.necisa.OZ@uunet.UU.NET
3rd Floor, 99 Nicholson St     UUCP: {enea,hplabs,mcvax,uunet,ukc}!\
St. Leonards NSW 2064 AUSTRALIA       munnari!astra.necisa.OZ!dave

gew@dnlunx.UUCP (Weijers G.A.H.) (10/12/87)

In article <270@astra.necisa.oz>, dave@astra.necisa.oz (Dave Horsfall) writes:
> One would think that TAB could be mapped into ^T with "map! ^V^I ^V^T",
> but no - it says "Missing rhs".  Obviously, the ^V does not escape white
> space.

use map ^V^V^I <something> (don't ask why). This works on Ultrix V1.2 vi.
-- 
Ge' Weijers                       {verbose disclaimer omitted}
PTT Dr. Neher Laboratories        address change (15th of october)
Leidschendam, the Netherlands     
uucp:  {uunet!}mcvax!dnlunx!gew   uucp: {uunet!}mcvax!hobbit!ge

boykin@custom.UUCP (Joseph Boykin) (10/12/87)

In article <270@astra.necisa.oz>, dave@astra.necisa.oz (Dave Horsfall) writes:
> A common technique in VI is to use tab stops every 4 columns by using
> sw=4 and ^D ^T.  However, after a career of bashing the TAB key, it is
> difficult to adjust.
> 
> One would think that TAB could be mapped into ^T with "map! ^V^I ^V^T",
> but no - it says "Missing rhs".  Obviously, the ^V does not escape white
> space.
> 
> Is this a bug or a feature?  I don't have VI source, which is probably
> just as well - it's been known to drive strong men (& women?) to drink.

I'm not sure whether this should rightly be considered a bug or
not, but personally I would probably say no.  By definition,
VI use white space to separate the two parameters to the macro.
If you use ^V^I the only thing you get is a ^I and VI will
obviously treat this as white space.  The way around this is
to use *TWO* Control-V's, e.g.:

			:map! ^V^V^I ^V^T

The result is that a ^V is now entered into the input buffer and
VI interprets the remainder of the line as you would want.
Note that the same situation arises when trying to use
spaces or carriage returns.

-- 

Joe Boykin
Custom Software Systems
...necntc!custom!boykin

maart@cs.vu.nl (Maarten Litmaath) (10/12/87)

In article <270@astra.necisa.oz> dave@astra.necisa.oz (Dave Horsfall) writes:
\A common technique in VI is to use tab stops every 4 columns by using
\sw=4 and ^D ^T.  However, after a career of bashing the TAB key, it is
\difficult to adjust.
\
\One would think that TAB could be mapped into ^T with "map! ^V^I ^V^T",
\but no - it says "Missing rhs".  Obviously, the ^V does not escape white
\space.
\
\Is this a bug or a feature?  I don't have VI source, which is probably
\just as well - it's been known to drive strong men (& women?) to drink.
\
\-- 
\Dave Horsfall  (VK2KFU)        ACS:  dave@astra.necisa.OZ
\NEC Information Systems Aust.  ARPA: dave%astra.necisa.OZ@uunet.UU.NET
\3rd Floor, 99 Nicholson St     UUCP: {enea,hplabs,mcvax,uunet,ukc}!\
\St. Leonards NSW 2064 AUSTRALIA       munnari!astra.necisa.OZ!dave

Use

	:map! ^V^V^V^I ^V^T	(the tab has to be escaped twice)

and all's fine.
Good luck!
-- 
       ### --------                  |  Maarten Litmaath
         # |$...@.+###   Hack        |  maart@cs.vu.nl
         ##+..c../|      scene       |  University without heavy iron ball
           --------                  |  - Amsterdam