thomas wrote:
Hi
Mapping seems to be buggy with some characters.
For instance:
:imap ' foo
does not work (the apostrophe is U+2019). If the mapped string
contains this apostrophe but does not begin with it, there is no
problem. For instance, this works:
:imap x' foo
But it is impossible to map a string beginning with this apostrophe,
and the <Char-0x2019> construct does not help. This is weird, because
there is no problem with mapping the usual apostrophe U+0027. Other
paradoxes can be found : It is possible to map the no-break space
(U+00A0) but not its thin version (U+202F), the usual minus sign
(U+002D) but not the en-dash (U+2013) and the em-dash (U+2014).
I first thought vim had a problem with mapping multibyte characters
but it actually deals well with most of them. Any explanation, why the
mapping does not work with some characters?
Thanks for your help
Thomas
What is 'encoding' set to? Using multibyte characters (e.g. in a mapping) will
only work if 'encoding' (which defines how characters are represented
internally in Vim memory) is set to an appropriate multibyte setting
beforehand, for instance like this:
if has("multi_byte")
if &enc !=? '^u' " if already Unicode, no need to set it again
if &tenc == ""
" avoid clobbering the keyboard encoding
let &tenc = &enc
endif
set enc=utf-8
endif
setglobal bomb fenc=latin1 " defaults for new files
scriptencoding utf-8
imap <Char-0x2019> foo
else
echomsg "Warning: No multibyte support compiled-in!"
endif
Best regards,
Tony.
--
"A radioactive cat has eighteen half-lives."