Christian Brehm wrote:
First, thanks for the answer, Tony.

OK, I think I've put it into wrong words. Probably it is not a multibyte
problem.
I can enter digraphs with Ctrl-K or Ctrl-V. But I cannot enter
characters using the alt-Key, those ones with Alt-Gr work.
On another machine running Suse 9.3 this works, e.g. entering Alt-q in
insert mode produces the same character that Ctrl-k n?.
The problem is that I cannot use mappings with Alt!

I tried different givm Versions, I even compiled the latest stable
version from vim.org on my own. But the described effect remains.
The Alt-Key itself works, e.g. in xterm or firefox. I can also handle
the gvim installed at that other machine via ssh, and there as mentioned
alt-mappings do what they should.

Any further hints?

Cheers
Christian


IMO this is not a Vim problem but at least partly an OS problem. If the Alt key works in xterm it should work in console Vim in xterm. If it works in Firefox it may or may not work in gvim, because there are several ways to get what you typed and some are more portable than others: gvim uses "cooked" keyboard input, which is most portable (I mean, simplest to program in a cross-platform way), but also depends most on the OS's "goodwill" to translate the user's keystrokes. In my gvim on SuSE 9.3 the Ctrl key doesn't even work for any nonalphabetic printable key (e.g., Ctrl-X works, Ctrl-Right works, but Ctrl-] doesn't work) so I remap them (e.g., ":map <F9> <C-]>" to follow help hyperlinks).

If the Alt key does not work in console Vim in Xterm you may try fixing your keyboard map using the Xmodmap program (see "man Xmodmap" for details). I don't know if this will also fix your problems with gvim (which, after all, also goes through the X server for keyboard input); if it doesn't, you may want to hunt after a keyboard utility in your system menu, your kde "K" menu or whatever corresponds to them on your system.

If you cannot (or don't want to) use Xmodmap etc., or if they don't work in gvim, then instead of Normal-mode mappings using the Alt key, you may want to reassign your mappings to the Fn or Shift-Fn keys (which are easiest to detect portably, and do not collide with predefined Vim keystrokes) or, if you have a huge lot of them, to multikey {lhs}es using a well-chosen prefix keystroke which can be an Fn key or (since those work for you) an AltGr key combo. This would be a "vim" solution, unlike Xmodmap which is an "X" solution.

In Insert mode, to enter Latin1 accented characters (such as the n-tilde you mentioned, but also, among others, c-cedilla and vowels with acute, grave or circumflex accents, tilde or umlaut) you may try, in addition to the "Ctrl-K" digraph method you mentioned, the "accents" keymap distributed with Vim: see
        :help 'keymap'
        :help mbyte-keymap


Best regards,
Tony.

Reply via email to