6

Moving away from using gnome-terminal and terminator since they are excruciatingly slow. (20-30 seconds to change focus to them for whatever reason)

xterm is nice and fast. However, I need to be able to type certain unicode characters in vim for documents I am working on. With gnome-terminal and terminator I could do ctrl+shift+u + hex code, however that does not work in xterm.

How do I type arbitrary unicode characters in xterm?

OS is Debian 8.

Thanks!

6

xterm doesn't implement a hexadecimal-input feature because all of the text editors which handle UTF-8 provide their own equivalents (emacs, vim and vile, of course, even nano). This could be useful in a shell script, but is not often mentioned. The feature was first implemented in Windows, of course.

To enter multibyte (e.g., UTF-8) characters in xterm, you would use compose sequences. As a special case, the meta key can be used as a sort of shift to get the 128-255 coverage of UTF-8, but aside from that, compose is what works.

gnome-terminal (more properly VTE), also implements compose, although there are some differences.

Further reading:

| improve this answer | |
  • Couldn't Ctrl+Shift+U or something like it be implemented through an input method? Not that I think character input via codepoint number is convenient, but I don't see why it wouldn't be possible. – Gilles 'SO- stop being evil' May 2 '16 at 0:01
  • Perhaps, but the ones I recall don't do it that way. They are essentially extensions of the compose feature. – Thomas Dickey May 2 '16 at 0:03
2

As Thomas Dickey explains, xterm has no built-in way to input characters by codepoint. (Presumably because that's pretty bad UX.)

Vim does, though: in insert mode, press Ctrl+V then u then 4 hex digits (or Ctrl+V then U then 8 hex digits). For a more convenient way to input characters, use Compose, digraphs (which are Vim's built-in compose facility), or an input method suited to the language you're writing in.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.