patch 9.1.1679: unclear what key causes CmdlineLeave autocommand

Problem:  unclear what key causes CmdlineLeave autocommand
Solution: Set |v:char| to the key (Girish Palya).

related: #17806
closes: #18063

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-08-23 18:08:27 +02:00
committed by Christian Brabandt
parent 53466887f7
commit ba9551d131
7 changed files with 41 additions and 4 deletions

View File

@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 9.1. Last change: 2025 Jun 19
*autocmd.txt* For Vim version 9.1. Last change: 2025 Aug 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -644,6 +644,8 @@ CmdlineLeave Before leaving the command line; including
<afile> is set to a single character,
indicating the type of command-line.
|cmdwin-char|
Sets the |v:char| to the key that exited the
command-line (e.g. <CR>, <CTRL-C>, <Esc>).
*CmdlineLeavePre*
CmdlineLeavePre Just before leaving the command line, and
before |CmdlineLeave|. Useful for capturing
@ -656,6 +658,7 @@ CmdlineLeavePre Just before leaving the command line, and
or <Esc>. <afile> is set to a single
character indicating the command-line type.
See |cmdwin-char| for details.
Sets |v:char| as with |CmdlineLeave|.
*CmdwinEnter*
CmdwinEnter After entering the command-line window.
Useful for setting options specifically for

View File

@ -2227,8 +2227,8 @@ v:beval_winid The |window-ID| of the window, over which the mouse pointer
*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|, |InsertEnter| and
|KeyInputPre| events.
It is also used by the |InsertCharPre|, |InsertEnter|,
|KeyInputPre|, |CmdlineLeave| and |CmdlineLeavePre| events.
*v:charconvert_from* *charconvert_from-variable*
v:charconvert_from

View File

@ -41750,6 +41750,8 @@ Others: ~
ANGLE BRACKET "]>".
- Support for Unix domain sockets have been added for the clientserver
feature, see |socketserver-clientserver|.
- |CmdlineLeave| sets |v:char| to the character that caused exiting the
Command-line.
Platform specific ~
- MS-Winodws: Paths like "\Windows" and "/Windows" are now considered to be