1

I have a Hungarian keyboard and in the terminal pressing Ctrl and any of öüóéá will produce the character that would be there on the English layout, so 0-=;' respectively in both kitty and gnome-terminal. Ctrl + őúű don't produce characters and seem to do slightly different things in the two emulators. In kitty Ctrl+0 produces a 0 and Ctrl+í produces a <, while in gnome-terminal Ctrl+0 seems to do nothing and Ctrl+í produces an í.

I have two related questions:

  • how to do I figure out what the non-character producing sequences actually do?
  • what is the explanation for this behaviour? I would've assumed these non-ascii characters do suffer from this "ctrl-i is tab" type of issues.

(This probably does not have a definite answer and is slightly unrelated as well, but is there a chance that in the future terminals will handle keys "normally" like GUI software? This behaviour gets really irritating when trying to map keys in vim :))

2
  • Which distribution? Commented Jan 16, 2022 at 17:27
  • Ubuntu 20.04 (sorry, didn't think it was relevant) Commented Jan 16, 2022 at 18:59

1 Answer 1

1

Keyboard mappings might depend on the environment (X, console, application, ...) and are not the easiest thing to deal with, but this might help.

Keymaps are defined in files. Your environment picks one up and then starts interpreting each key code according to the rules in the keymap.

Say you're using this Hungarian keymap (location might vary for other distributions, this works for Debian): /usr/share/keymaps/i386/qwerty/hu101.kmap

If you look at it (zless, zcat, ...) you will find the information you are looking at, well, almost:

# Hungarian keymap for 101 key keyboards (iso8859-2) ... include "linux-with-alt-and-altgr" ... keycode 11 = +odiaeresis +Odiaeresis doubleacute alt keycode 11 = Meta_zero 

That defines just the normal key and the Alt+ key.

So, where does the Ctrl+ combination come from? You have to check the included files, and the ones included by them, until you find it.

You can add a new keymap, change an existing one, or just do a live modification with xmodmap (many examples in the manpage). xmodmap works on a sort of compiled version, so you don't have to traverse the include chain yourself.

Why is that so? Well, people localizing the keyboards usually modify just the things everybody has agreed on, like the location of Ö for a Hungarian keyboard and inherit the rest of the configuration from the more general keyboards, like linux-bare-keys, pc101.

What should Ctrl+Ö return? If there is no definite answer with global consensus, then it is left untouched, but customizable by the user.

You can create a new keyboard that maps those Ctrl+Ö,Ü,... to, say, the version without diaeresis. It would be something like hungarian-ctrl-diaresisless. You can the propose those to the package maintainers if you think it should be available to everybody.

4
  • Thanks, this was actually way more insightful (and hopeful that I can configure it properly) than I imagined! Commented Jan 16, 2022 at 19:01
  • Hmm, so you are saying this might not have anything to do with the terminal? I just realized the keys worked in GUI vim (mapping to <C-ú> to something), but not in terminal vim. Commented Jan 16, 2022 at 19:03
  • I'll check the files and the xmodmap and see if it can be tweaked or not. Commented Jan 16, 2022 at 19:04
  • It depends on the environment. Some things are hardwired for some applications and the only solution is to rebuild them. That's what I meant by dependency on the environment. No silver bullets for keyboard mapping... Commented Jan 16, 2022 at 19:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.