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
--
Due to circumstances beyond our control, we regret to inform you that
circumstances are beyond our control. -Paul Benoit
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php