patch 9.1.0563: Cannot process any Key event
Problem: Cannot process any Key event
Solution: Add the KeyInputPre autocmd
(Shougo Matsushita)
closes: #15182
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 23f1cbf..1e9c896 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt* For Vim version 9.1. Last change: 2024 Jul 09
+*autocmd.txt* For Vim version 9.1. Last change: 2024 Jul 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -439,6 +439,8 @@
|CompleteDone| after Insert mode completion is done, after clearing
info
+|KeyInputPre| just before a key is processed
+
|User| to be used in combination with ":doautocmd"
|SigUSR1| after the SIGUSR1 signal has been detected
@@ -977,6 +979,21 @@
*InsertLeave*
InsertLeave Just after leaving Insert mode. Also when
using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
+ *KeyInputPre*
+KeyInputPre Just before a key is processed. The pattern is
+ matched against a string that indicates the
+ current mode, which is the same as what is
+ returned by `mode(1)`.
+ The |v:char| variable indicates the key typed
+ and can be changed during the event to process
+ a different key. When |v:char| is not a
+ single character or a special key, the first
+ character is used.
+ The following values of |v:event| are set:
+ typed The key is typed or not.
+ It is not allowed to change the text
+ |textlock| or the current mode.
+ {only with the +eval feature}
*MenuPopup*
MenuPopup Just before showing the popup menu (under the
right mouse button). Useful for adjusting the
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 18cd2c1..eddafd0 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1995,7 +1995,8 @@
*v:char* *char-variable*
v:char Argument for evaluating 'formatexpr' and used for the typed
character when using <expr> in an abbreviation |:map-<expr>|.
- It is also used by the |InsertCharPre| and |InsertEnter| events.
+ It is also used by the |InsertCharPre|, |InsertEnter| and
+ |KeyInputPre| events.
*v:charconvert_from* *charconvert_from-variable*
v:charconvert_from
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 1238a9c..b3761e8 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -5554,6 +5554,7 @@
K various.txt /*K*
KDE gui_x11.txt /*KDE*
KVim gui_x11.txt /*KVim*
+KeyInputPre autocmd.txt /*KeyInputPre*
Kibaale uganda.txt /*Kibaale*
Korean mbyte.txt /*Korean*
L motion.txt /*L*
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index ed1cd43..cfeb28c 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -41607,6 +41607,7 @@
Autocommands: ~
|CursorMovedC| after the cursor was moved in the comamnd-line
+|KeyInputPre| process any Key event in any mode
|SessionWritePost| after writing the session file |:mksession|
|TermResponseAll| after the terminal response to |t_RV| and others is
received