patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Problem: Cannot debug the Kitty keyboard protocol with TermDebug.
Solution: Add Kitty keyboard protocol support to the libvterm fork.
Recognize the escape sequences that the protocol generates. Add
the 'keyprotocol' option to allow the user to specify for which
terminal what protocol is to be used, instead of hard-coding this.
Add recognizing the kitty keyboard protocol status.
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index f2b6a61..adccae8 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -10,18 +10,19 @@
manual.
1. Key mapping |key-mapping|
- 1.1 MAP COMMANDS |:map-commands|
- 1.2 Special arguments |:map-arguments|
- 1.3 Mapping and modes |:map-modes|
- 1.4 Listing mappings |map-listing|
- 1.5 Mapping special keys |:map-special-keys|
- 1.6 Special characters |:map-special-chars|
- 1.7 What keys to map |map-which-keys|
- 1.8 Examples |map-examples|
- 1.9 Using mappings |map-typing|
- 1.10 Mapping alt-keys |:map-alt-keys|
- 1.11 Mapping in modifyOtherKeys mode |modifyOtherKeys|
- 1.12 Mapping an operator |:map-operator|
+ 1.1 MAP COMMANDS |:map-commands|
+ 1.2 Special arguments |:map-arguments|
+ 1.3 Mapping and modes |:map-modes|
+ 1.4 Listing mappings |map-listing|
+ 1.5 Mapping special keys |:map-special-keys|
+ 1.6 Special characters |:map-special-chars|
+ 1.7 What keys to map |map-which-keys|
+ 1.8 Examples |map-examples|
+ 1.9 Using mappings |map-typing|
+ 1.10 Mapping alt-keys |:map-alt-keys|
+ 1.11 Mapping in modifyOtherKeys mode |modifyOtherKeys|
+ 1.12 Mapping with Kitty keyboard protocol |kitty-keyboard-protocol|
+ 1.13 Mapping an operator |:map-operator|
2. Abbreviations |abbreviations|
3. Local mappings and functions |script-local|
4. User-defined commands |user-commands|
@@ -1009,7 +1010,34 @@
Insert mode to avoid every key with a modifier causing Insert mode to end.
-1.12 MAPPING AN OPERATOR *:map-operator*
+1.12 MAPPING WITH KITTY KEYBOARD PROTOCOL *kitty-keyboard-protocol*
+
+If the value of 'term' contains "kitty" then Vim will send out an escape
+sequence to enable the Kitty keyboard protocol. This can be changed with the
+'keyprotocol' option.
+
+Like modifyOtherKeys, this will make it possible to distinguish between more
+keys with modifiers. Also, this protocol sends an escape sequence for the Esc
+key, so that Vim does not need to use a timeout to know whether receiving an
+Esc character means the Esc key was pressed or it's the start of an escape
+sequence.
+
+Vim automatically detects if the Kitty keyboard protocol was enabled when it
+spots the response to the status request (this should be part of the |t_TI|
+termcap entry). To see if Vim detected such an escape sequence use: >
+ :verbose map
+The first line will then show "Kitty keyboard protocol: {value}" (possibly
+translated). The meaning of {value}:
+ Unknown no status received yet
+ Off protocol is not used
+ On protocol is used
+ Disabled protocol was used but expected to have been disabled
+ by 't_TE'
+ Cleared protocol expected to have beeen disabled by 't_TE',
+ previous state is unknown
+
+
+1.13 MAPPING AN OPERATOR *:map-operator*
An operator is used before a {motion} command. To define your own operator
you must create a mapping that first sets the 'operatorfunc' option and then
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index f4bf379..d062af4 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4888,6 +4888,50 @@
<PageUp> and <PageDown>.
The 'keymodel' option is set by the |:behave| command.
+ *'keyprotocol'* *'kpc'*
+'keyprotocol' 'kpc' string (default: see below)
+ global
+ Specifies what keyboard protocol to use depending on the value of
+ 'term'. The supported keyboard protocols names are:
+ none whatever the terminal uses
+ mok2 modifyOtherKeys level 2, as supported by xterm
+ kitty Kitty keyboard protocol, as supported by Kitty
+
+ The option value is a list of command separated items. Each item has
+ a pattern that is matched against the 'term' option, a colon and the
+ protocol name to be used. To illustrate this, the default value would
+ be set with: >
+ set keyprotocol=kitty:kitty,foot:kitty,wezterm:kitty,xterm:mok2
+
+< This means that when 'term' contains "kitty, "foot" or "wezterm"
+ somewhere then the "kitty" protocol is used. When 'term' contains
+ "xterm" somewhere, then the "mok2" protocol is used.
+
+ The first match is used, thus if you want to have "kitty" use the
+ kitty protocol, but "badkitty" not, then you should match "badkitty"
+ first and use the "none" value: >
+ set keyprotocol=badkitty:none,kitty:kitty
+<
+ The option is used after 'term' has been changed. First the termcap
+ entries are set, possibly using the builtin list, see |builtin-terms|.
+ Then this option is inspected and if there is a match and a protocol
+ is specified the following happens:
+ none Nothing, the regular t_TE and t_TI values remain
+
+ mok2 The t_TE value is changed to:
+ CSI >4;m disables modifyOtherKeys
+ The t_TI value is changed to:
+ CSI >4;2m enables modifyOtherKeys
+
+ kitty The t_TE value is changed to:
+ CSI >4;m disables modifyOtherKeys
+ CSI <u disables the kitty keyboard protocol
+ The t_TI value is changed to:
+ CSI >1u enables the kitty keyboard protocol
+ CSI ?u request kitty keyboard protocol state
+ CSI >c request the termresponse
+
+
*'keywordprg'* *'kp'*
'keywordprg' 'kp' string (default "man" or "man -s", DOS: ":help",
VMS: "help")
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index adf2b4f..ddabeef 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -775,6 +775,7 @@
'key' encryption key
'keymap' 'kmp' name of a keyboard mapping
'keymodel' 'km' enable starting/stopping selection with keys
+'keyprotocol' 'kpc' what keyboard protocol to use for what terminal
'keywordprg' 'kp' program to use for the "K" command
'langmap' 'lmap' alphabetic characters for other language mode
'langmenu' 'lm' language to be used for the menus