patch 9.0.0939: still using simplified mappings when using kitty protocol
Problem: Still using simplified mappings when using the kitty keyboard
protocol.
Solution: Use the kitty_protocol_state value to decide whether to use
simplified mappings. Improve how seenModifyOtherKeys is set and
reset.
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 19797b2..e0c7106 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -971,13 +971,18 @@
Xterm and a few other terminals can be put in a mode where keys with modifiers
are sent with a special escape code. Vim recognizes these codes and can then
make a difference between CTRL-H and Backspace, even when Backspace sends the
-character 8. And many more special keys.
+character 8. And many more special keys, such as Tab and CTRL-I, which cannot
+be mapped separately otherwise.
For xterm modifyOtherKeys is enabled in the builtin termcap entry. If this is
not used you can enable modifyOtherKeys with these lines in your vimrc: >
let &t_TI = "\<Esc>[>4;2m"
let &t_TE = "\<Esc>[>4;m"
+This sets modifyOtherKeys to level 2. Note that modifyOtherKeys level 1 does
+not work. Some terminals do not support level 2 and then send key codes that
+Vim will not be able to correctly recognize.
+
In case the modifyOtherKeys mode causes problems you can disable it: >
let &t_TI = ""
let &t_TE = ""
@@ -1001,10 +1006,15 @@
detected such an escape sequence use `:verbose map`, the first line will then
show "Seen modifyOtherKeys: true" (possibly translated).
+This automatic detection depends on receiving an escape code starting with
+"<1b>[27;". This is the normal way xterm sends these key codes. However, if
+the *formatOtherKeys* resource is set another form is used that is not
+recognized, therefore you must not set formatOtherKeys.
+
A known side effect is that in Insert mode the raw escape sequence is inserted
after the CTRL-V key. This can be used to check whether modifyOtherKeys is
enabled: In Insert mode type CTRL-SHIFT-V CTRL-V, if you get one byte then
-modifyOtherKeys is off, if you get <1b>27;5;118~ then it is on.
+modifyOtherKeys is off, if you get <1b>[27;5;118~ then it is on.
When the 'esckeys' option is off, then modifyOtherKeys will be disabled in
Insert mode to avoid every key with a modifier causing Insert mode to end.