Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt+< not sent to vim #2112

Closed
kuon opened this issue Nov 4, 2019 · 4 comments
Closed

Alt+< not sent to vim #2112

kuon opened this issue Nov 4, 2019 · 4 comments

Comments

@kuon
Copy link

kuon commented Nov 4, 2019

I have a swiss french keyboard layout, in vim, I have the following mapping:

nnoremap <M-<> :noh<CR>

It works with other terminal emulators, but under kitty, the sequence isn't sent to vim.

This is the sequence with xev

KeyPress event, serial 34, synthetic NO, window 0x7600001,
    root 0x1eb, subw 0x0, time 207160650, (-4,684), root:(3840,708),
    state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 34, synthetic NO, window 0x7600001,
    root 0x1eb, subw 0x0, time 207160902, (-4,684), root:(3840,708),
    state 0x18, keycode 94 (keysym 0x3c, less), same_screen YES,
    XLookupString gives 1 bytes: (3c) "<"
    XmbLookupString gives 1 bytes: (3c) "<"
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x7600001,
    root 0x1eb, subw 0x0, time 207160973, (-4,684), root:(3840,708),
    state 0x18, keycode 94 (keysym 0x3c, less), same_screen YES,
    XLookupString gives 1 bytes: (3c) "<"
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x7600001,
    root 0x1eb, subw 0x0, time 207161053, (-4,684), root:(3840,708),
    state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

It might be related to #2000.

@kovidgoyal
Copy link
Owner

presumably you are pressing some other modifier to get <? Use --debug-keyboard to figure out what actual keys GLFW sees and then map those to whatever bytes you want to get for Alt+< using the send_text directive in kitty.conf. You can use showkey -a to see the bytes probably \x1b \x3c

And yes almost certainly the issue described in #2000

@kuon
Copy link
Author

kuon commented Nov 4, 2019

< is the unmodified key, this is what I get if I press the key unmodified.

This is with --debug-keyboard:

Press scancode: 0x40 clean_sym: Alt_L composed_sym: Alt_L mods: numlock glfw_key: 342 (LEFT ALT) xkb_key: 65513 (Alt_L)
on_key_input: glfw key: 342 native_code: 0xffe9 action: PRESS mods: 0x0 text: '' state: 0 sent key to child
Press scancode: 0x5e clean_sym: less composed_sym: less mods: alt+numlock glfw_key: 60 (LESS) xkb_key: 60 (less)
on_key_input: glfw key: 60 native_code: 0x3c action: PRESS mods: 0x4 text: '' state: 0 sent key to child
Release scancode: 0x5e clean_sym: less mods: alt+numlock glfw_key: 60 (LESS) xkb_key: 60 (less)
on_key_input: glfw key: 60 native_code: 0x3c action: RELEASE mods: 0x4 text: '' state: 0 ignoring as keyboard mode does not allow release events
Release scancode: 0x40 clean_sym: Alt_L mods: alt+numlock glfw_key: 342 (LEFT ALT) xkb_key: 65513 (Alt_L)
on_key_input: glfw key: 342 native_code: 0xffe9 action: RELEASE mods: 0x4 text: '' state: 0 ignoring as keyboard mode does not allow release events

showkey -a doesn't show any output if I press Alt+<

@kovidgoyal
Copy link
Owner

Run showkey in a terminal where it works. Then use

send_text all alt+less whatever

in kitty.conf

@kuon
Copy link
Author

kuon commented Nov 4, 2019

Ho yeah, right.

This works in kitty.conf

send_text all alt+less \x1b\x3c

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants