You are not logged in.

#1 2014-09-03 13:30:32

Sventimir
Member
Registered: 2014-09-01
Posts: 16

[SOLVED] Unicode characters from keyboard in terminal

I'm not sure if this is the right section, but I couldn't find any more suitable, so posting here. I have quite a strange problem.

As I lately write much about bridge, I use ♣ ♦ ♥ ♠ symbols a lot. So I thought It would be nice to map some Alt+Ctrl combinations on my keyboard to enter them quickly. Using this page I did something like this in the keymap I load to my X-server on startup:

key <AC02> {      
    type= "CTRL+ALT",
    symbols[Group1]= [               s,               S,          sacute,          Sacute,      U2660 ]
};

... and similarly for <c>, <d> and <h> keys.

It works like a charm in all my applications except for terminal (Termite), where I happen to write the most (Vim). Instead of the proper character, Termite shows two unreadable characters (). The Ctrl+Shit+u combination on the other hand works in Termite too.

I use sole XMonad window manager and no GNOMEs/KDEs or such things. Does anyone have an idea why is that so or how to fix it?

Last edited by Sventimir (2014-09-04 09:07:04)

Offline

#2 2014-09-03 20:59:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Unicode characters from keyboard in terminal

Does it work in gvim?

Offline

#3 2014-09-04 00:59:52

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [SOLVED] Unicode characters from keyboard in terminal

Remapping the Alt key in in Vim on Termite may or may not work.  See

:h map-alt-keys

If you always have a space between the suit glyph and the next character, or follow the suit symbol by a newline character, I would suggest using an abbreviation.  In your .vimrc, add:

iab ,c ♣
iab ,d ♦
iab ,h ♥
iab ,s ♠

In Insert mode, typing a comma then an 's' and then a space or pressing 'Enter' prints the spade glyph.  Or choose another character instead of the comma,  perhaps the backslash, ' \ '.

Offline

#4 2014-09-04 02:15:32

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] Unicode characters from keyboard in terminal

Abbreviations are fine, but UltiSnips is better...
But without either, you can also do it with digraphs (Ctrl-K followed by two chars in insert mode). The builtin digraphs for the suits are cS cH cD cC, but the heart and diamond are the outline variant, which you can change by

digr cH 9829
digr cD 9830

This silver ladybug at line 28...

Offline

#5 2014-09-04 09:04:59

Sventimir
Member
Registered: 2014-09-01
Posts: 16

Re: [SOLVED] Unicode characters from keyboard in terminal

I don't know if it works in gvim. I'd need to uninstall vim to check that. But I suppose it would as it's obviously the Termite that causes trouble here.

Digraphs don't seem to work in my vim (neither in Termite nor outside X). (Installed from vim-python3 package from official Arch repository).

UltiSnips will do the trick. Thanks.

Last edited by Sventimir (2014-09-04 09:06:39)

Offline

#6 2014-09-06 00:41:08

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Unicode characters from keyboard in terminal

What do you mean by 'Digraphs don't seem to work'? What happens when you enter insert mode, press Ctrl+K followed by 'cS'?
It works in vim-minimal.

lolilolicon wrote:

the heart and diamond are the outline variant

I think outline variant means 'red' while the full variant means 'black'.

Offline

Board footer

Powered by FluxBB