Search code examples
vimxterm

Mapping Alt+umlaut in .vimrc using xterm doesn't work


The following mapping doesn't work:

noremap <A-ö> :do something

I use xterm (on Ubuntu) and mappings like <A-j> work. Mapping ö alone is possible but again, <C-ö> doesn't work.

What I've tried:

  • Adding set encoding=utf-8 at the beginning of the .vimrc
  • noremap <M-ö>

Ctrl+v followed by Alt+ö in insertion mode prints ö.

Is there a way to fix this?


Solution

  • This appears impossible because with Ctrl you get the ASCII control characters, which are defined as having a code of X-64, where X is the character you press with control (Ctrl-A is 65 - 64 = 1 = ASCII SOH and so on). But there's no ASCII code for 'Ö' to subtract from.

    There's a similar scheme for Alt, which IIRC, is adding some offset like 128 instead. Mapping Alt-Ö will fail for the same reason.