Reply to message «Mapping corruption mostly cured. [Was: Simple mapping 
accepted, but incorrectly displayed.]», 
sent 12:49:20 15 June 2011, Wednesday
by Erik Christiansen:

>    2) 'map' continues to work fine for me, on mappings which I have
>       used for many years, so there has been no need to look for
>       anything else. (Though I see that I have recently added a few
>       'imap' cases.)
> 
>    3) Apart from respecting your warning that there might be some
>       undefined trouble at some future point, due to some cause, there
>       has been no real or imagined reason to depart from using 'map'.
Reason for using `nore' is that remappable mappings can interfer with each 
other 
in an unwanted fashion, while `nore' version works always. So, for example, if 
I 
wanted to exchange `:' and `;' because `;' is faster to type and `:' is needed 
more often then `;', I would simply write
    noremap ; :
    noremap : ;
. Now try to do this with your setup.

*I do not know what I will map in the next few month.*
With `nore' I know that whatever I will want to map, it won't break things, and 
thus I should not bother myself with thinking about it.

> The last two mappings still provide corrupt output:
>  <A-<> becomes ¬ instead of «
>  <A->> becomes ® instead of »
> just as was the case with the original mapping.
Maybe some problems with `<A-<>' itself. I do not know how to avoid them: 
`inoremap <A-<> smth' does not work for me too. For terminals there is 
currently 
a workaround: `inoremap <Esc><LT> smth'. It works on my machine, but I know it 
to depend on setup of your terminal emulator.

> Your impressively masterly magic is still evaded by Vim in the last two
> cases. Using ':digr', I get « == 171, » == 187. That's 0xAB and 0xBB,
> counting on my fingers, so these are my current mappings, in .vimrc:
To get hex value of some character I usually write it in a buffer, put cursor 
on 
it and type `ga' in normal mode ('encoding', 'fileencoding' and $LANG are 
utf-8. 
Guess only the first should matter).

Original message:
> On 14.06.11 19:55, ZyX wrote:
> > First, you probably need insert mode mappings. Second, can you answer
> > why you don't use `nore'?
> 
> Certainly. There are several contributing reasons:
> 
>    1) In more than a decade of using Vim, I haven't encountered any
>       suggestion in the documentation that that might be advisable.
>       If it is important, then overview text or a link at ':h map' would
>       be helpful to users.
> 
>    2) 'map' continues to work fine for me, on mappings which I have
>       used for many years, so there has been no need to look for
>       anything else. (Though I see that I have recently added a few
>       'imap' cases.)
> 
>    3) Apart from respecting your warning that there might be some
>       undefined trouble at some future point, due to some cause, there
>       has been no real or imagined reason to depart from using 'map'.
> 
>    I'll move over to inoremap, as you advise.
> 
> > It is a general rule: use `nore' unless you know what you are
> > doing. Third, you should specify encoding of the file where mappings are.
> > Fourth, you should be sure that internal Vim encoding ('encoding' option)
> > has requested characters.
> > 
> > So you should write:
> >     " In the vimrc
> >     set encoding=utf-8
> >     
> >     " At the very top of any file containing non-ascii characters
> >     scriptencoding utf-8
> >     <...>
> >     inoremap <A-a> å
> >     inoremap <A-e> æ
> >     inoremap <A-o> ø
> >     inoremap <A-<> «
> >     inoremap <A->> »
> > 
> > Note that there are some issues with unicode characters containing 0x80
> > byte. If some of the mappings does not work, try replacing it with
> > 
> >     inoremap <expr> <A-C> "\uXXXX"
> > 
> > (where C is actual character and XXXX is a hex code for rhs).
> 
> Zyx, you are a 24 carat wizard. That works in the first three cases!
> 
> And yes, when using the digraph instead of <expr> and hex value, it is
> necessary to type <A-a> _Twice_ to get one å. And <A-e> is the same, but
> it takes _Three_ <A-o> before one ø is issued.
> 
> Your impressively masterly magic is still evaded by Vim in the last two
> cases. Using ':digr', I get « == 171, » == 187. That's 0xAB and 0xBB,
> counting on my fingers, so these are my current mappings, in .vimrc:
> 
> " To allow digraphed characters in mappings:
> " (Else Vim corrupts by default between mapping and invocation.)
> set encoding=utf-8
> scriptencoding utf-8
> 
> inoremap <expr> <A-a> "\uE5"
> inoremap <expr> <A-e> "\uE6"
> inoremap <expr> <A-o> "\uF8"
> inoremap <expr> <A-<> "\uAB"
> inoremap <expr> <A->> "\uBB"
> 
> The last two mappings still provide corrupt output:
>  <A-<> becomes ¬ instead of «
>  <A->> becomes ® instead of »
> just as was the case with the original mapping.
> 
> Many thanks for these fixes and workarounds, which cure the majority of
> the mapping corruption very satisfactorily.
> 
> I wonder why the last two mappings continue to corrupt so intractably?
> 
> Thanks again.
> 
> Erik

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to