[vim/vim] F3 doesn't work with Kitty keyboard protocol (Issue #13328)

33 views
Skip to first unread message

Emil Loer

unread,
Oct 12, 2023, 12:04:33 PM10/12/23
to vim/vim, Subscribed

Steps to reproduce

Using Vim 9.0.2000 and Kitty 0.30.1 on macOS 12.5. Both applications installed via Homebrew.

Term is set to xterm-kitty and :verbose map shows that the Kitty keyboard protocol is turned on.

  1. Start vim with vim -u NONE to bypass my .vimrc etc.
  2. Run the command set nocompatible
  3. Run the command :map <F3> :echo "hello"<CR>
  4. Press F3.
  5. Nothing happens.

Doing the same with the other function keys does work and print a "hello" message.

The output of <C-V><F3> in insert mode shows ^[[13~.

kitten show-key --key-mode kitty shows the following when pressing F3:

F3 PRESS 
CSI 13 ~

F3 RELEASE 
CSI 13 ; 1 : 3 ~

Expected behaviour

Status bar should have shown "hello".

Version of Vim

9.0.2000

Environment

macOS 12.5
Vim 9.0.2000
Kitty 0.30.1

Term is set to xterm-kitty and :verbose map shows that the Kitty keyboard protocol is turned on.

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13328@github.com>

Christian Brabandt

unread,
Oct 12, 2023, 12:07:06 PM10/12/23
to vim/vim, Subscribed

does this only affect F3? can you run with --log filename and show the filename output please?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13328/1759926682@github.com>

Emil Loer

unread,
Oct 12, 2023, 12:15:34 PM10/12/23
to vim/vim, Subscribed

Here is a log file containing the following events:

  1. set nocompatible
  2. `map :echo "hello"
  3. Pressing F3, nothing happens
  4. `map :echo "hello"
  5. Pressing F2, seeing "hello" appear on screen

vim.log

I have tried this with all function keys from F1 up to F10, and only F3 seems to be affected.

There is a comment in the Kitty keyboard protocol specification about a special case for F3, perhaps this may shed some light on the issue. https://sw.kovidgoyal.net/kitty/keyboard-protocol/#functional-key-definitions (at the bottom of the linked section).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13328/1759939660@github.com>

Christian Brabandt

unread,
Oct 26, 2023, 7:06:17 PM10/26/23
to vim/vim, Subscribed

Hm, if I understand this correctly:

  0.015215000 : Adding termcap entry k2 to �OQ
  0.015222000 : Adding termcap entry k3 to �OR

Then those are the byte codes for f2 and f3 and those come from termcap:

infocmp -L -1 xterm-kitty|grep 'key_f[1-9]='
        key_f1=\EOP,
        key_f2=\EOQ,
        key_f3=\EOR,
        key_f4=\EOS,
        key_f5=\E[15~,
        key_f6=\E[17~,
        key_f7=\E[18~,
        key_f8=\E[19~,
        key_f9=\E[20~,

You can see, that key_f3 is wrong, your f3 sends actually \E[13~ instead.

You can fix this in Vim using:

:set t_kf3=<c-v><f3> (this means, press Ctrl-V followed by f3, to get the key value literally).

I am not sure this is something to fix in Vim, I would hope the termcap database will get updated eventually.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13328/1782028135@github.com>

Christian Brabandt

unread,
Oct 27, 2023, 10:38:55 AM10/27/23
to vim/vim, Subscribed

to add to this, I think it should also be possible to compile your own termcap entry with a fixed f3 code, which you could then use and I think Vim would then recognize your key.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13328/1783029506@github.com>

Christian Brabandt

unread,
Nov 5, 2023, 4:13:00 AM11/5/23
to vim/vim, Subscribed

Closed #13328 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/13328/issue_event/10864553664@github.com>

Reply all
Reply to author
Forward
0 new messages