Meino Christian Cramer wrote:
Hi,

 I want to remap the german umlauts to "{","[","]" and "}" in normal
 mode only.

 When I type the umlauts on the commandline of my zsh there is no
 problem.
When I type them in insert mode in vim: no problems.
 Therefore I /think/ (read: dont no for sure) that there should be no
 problem.

 In my $HOME/.vimrc I wrote:

 nnoremap o [
 nnoremap a ]
 nnoremap O {
 nnoremap A }

 (I replaced the umlauts with their corresponding vowels here in this
 mail only -- just to make them displayable in any case...)
But this does not work. With the :map command I can see the maps but
 the umlauts looks like 8bit-something. Two of them are displayed as
 two characters.

 Then I tried:

 nnoremap <o> <[>
 nnoremap <a> <]>
 nnoremap <O> <{>
 nnoremap <A> <}>

 which results in nothing: Now the "corrupted" maps via the :map
 command has vanished completly.

 Now I got an Error message displayed in front of my inner eye:
 "WARNING! Idea stack underflow!"

 What can I try else ?

 Thank you very much for any help in advance !
 Keep hacking!
 mcc



You should not change 'encoding' after setting your maps; and if your vimrc's 'fileencoding' is not your 'encoding' then it ought to have a ":scriptencoding" statement.

Or else, you can encode it in 7-bit ASCII using <Char-nn> notation, e.g.

        exe "noremap <Char-196> }"      | " LATIN CAPITAL A WITH DIAERESIS
        exe "noremap <Char-214> {"      | " LATIN CAPITAL O WITH DIAERESIS
        exe "noremap <Char-228> ]"      | " LATIN SMALL A WITH DIAERESIS
        exe "noremap <Char-246> ["      | " LATIN SMALL O WITH DIAERESIS

The above should work regardless of whether your 'encoding' is Latin1, UTF-8, or (I think) cp1252; but if you use an 'encoding' different from your "locale" charset, you should still set 'encoding' first and define the mappings afterwards. (I use ":exe" wrapping here to allow a comment on the same line.)

Similarly:
        Ä       196     0xC4    LATIN CAPITAL A WITH DIAERESIS
        Ö       214     0xD6    LATIN CAPITAL O WITH DIAERESIS
        Ü       220     0xDC    LATIN CAPITAL U WITH DIAERESIS
        ß       223     0xDF    LATIN SMALL LETTER SHARP S
        ä       228     0xE4    LATIN SMALL A WITH DIAERESIS
        ö       246     0xF6    LATIN SMALL O WITH DIAERESIS
        ü       252     0xFC    LATIN SMALL U WITH DIAERESIS

see
        :help <Char>
        :help :scriptencoding
        http://www.unicode.org/charts/PDF/U0080.pdf
        etc.


Best regards,
Tony.

Reply via email to