When using Vim in Kitty, I can map Alt+[a-z] (Alt and a lowercase letter) without issues, but I cannot map Alt+[A-Z] (Alt and an uppercase letter).
To reproduce on macOS, make sure you are running Kitty with the macos_option_as_alt
setting:
kitty -c NONE -o macos_option_as_alt=both
Verify mapping without Shift works:
vim -Nu NONE +'nnoremap <M-b> <Cmd>echomsg "M-b"<CR>'
Alt+b
M-b
message appears.Reproduce mapping with Shift does not work:
vim -Nu NONE +'nnoremap <M-B> <Cmd>echomsg "M-B"<CR>'
Alt+Shift+b
In both cases, you can verify that the Kitty Keyboard Protocol is used with :verbose map
. For example:
Kitty keyboard protocol: On
n <M-b> * <Cmd>echomsg "M-b"<CR>
Last set from -c argument
v <BS> "-d
v <D-x> "*d
v <D-c> "*y
v <D-v> "-d"*P
n <D-v> "*P
Press ENTER or type command
Curiously, in WezTerm, which implements the same keyboard protocol, Vim doesn't recognize a difference between pressing Alt+[a-z]
and Alt+Shift+[a-z]
. To reproduce this behavior, run WezTerm with the Kitty Keyboard Protocol enabled:
wezterm --config enable_kitty_keyboard=true
If using macOS, use the left alt/option key with WezTerm to avoid the default option key composition.
vim -Nu NONE +'nnoremap <M-b> <Cmd>echomsg "M-b"<CR>'
Alt+b
M-b
message appearsAlt+Shift+b
and verify the M-b
message appears.I expect the <M-B>
mapping to work when pressing Alt+Shift+B
in Kitty (and WezTerm).
9.0.1250
OS: macOS Ventura 13.1
Terminals: Kitty 0.26.5, WezTerm 20221119-145034-49b9839f
$TERM: xterm-kitty, wezterm
Shell: zsh 5.8.1 (x86_64-apple-darwin22.0)
With vim -Nu NONE --log vim.txt in Kitty, I get the following sequence for pressing Alt+b and then Alt+Shift+B. 98;3u and 98;4u match the Kitty Keyboard Protocol expected sequences for Alt without Shift and Alt+Shift. 2.590488 : raw key input: "�[98;3u" 2.590570 : SafeState: reset: key typed 2.590589 : SafeState: Start triggering 2.590613 : raw terminal output: "�" 2.590625 : looking for messages on channels 2.590633 : SafeState: back to waiting, triggering SafeStateAgain 4.072293 : raw key input: "�[98;4u" 4.072357 : SafeState: reset: ins_typebuf() 4.072395 : SafeState: Start triggering 4.072420 : raw terminal output: "�" 4.072431 : looking for messages on channels 4.072439 : SafeState: back to waiting, triggering SafeStateAgai
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Can you try, if mapping <M-S-B>
works instead?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Try out with patch 9.0.1276 if you can.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Patch 9.0.1276 resolves my issue, thanks.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #11936 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.