[comp.editors] Vi mapping question

fowser@vax1.acs.udel.EDU (Scott Fowser) (12/22/88)

How can the "V" key be defined so as to act like the "H" command, while
the "H" key is defined to be "12h"?

I have tried
    :map V H
    :map H 12h
with and without remap set, and can only get one of the keys to do what I
want.  I have also tried
    :map V :set noremap^MH:set remap^M
but it still does not work.

boykin@multimax.Encore.COM (Joe Boykin) (12/22/88)

In article <2588@udccvax1.acs.udel.EDU> fowser@vax1.acs.udel.EDU (Scott Fowser) writes:
>How can the "V" key be defined so as to act like the "H" command, while
>the "H" key is defined to be "12h"?
>
>I have tried
>    :map V H
>    :map H 12h
>with and without remap set, and can only get one of the keys to do what I
>want.  I have also tried
>    :map V :set noremap^MH:set remap^M
>but it still does not work.


The first problem is that the mappings are not doing exactly what you want
them to.  Think of them as "text replacement" more than changing how a
particular capability is invoked.  If you issue the two MAP commands
you have above then the "V" command would actually issue the "12h"
command.  If you remap the "H" key, there is no way (except with
other sequences of commands which provide the same functionality) to
obtain that same function.

The second problem is that when you issue the commands as shown above,
the mapping of V is deleted when you do the mapping of H.  The reason for 
this is that that the "source" for the second map command ("H"), is found
in the "replacement" string of the first, and that slot is reused.  I always
thought this was a bug.

Issue the MAP commands in reverse order and you will find that both now
exist.

If "noremap" is set than the "V" will do what you want since this will
not be remapped to 12h.  That's the good news.  The bad news is that this
also prevents the H macro from working; I'm not sure why.  I have a feeling
that getting into the debbuger is the only way to figure it out.

----

Joe Boykin
Encore Computer Corp
Chairman, IEEE Computer Societies'
    Technical Committee on Operating Systems

UUCP: encore!boykin
ARPA: boykin@encore.com