@@ -897,6 +897,7 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
897897
898898 // Trigger CmdlineLeavePre autocommands if not already triggered.
899899 if (!s -> event_cmdlineleavepre_triggered ) {
900+ set_vim_var_char (s -> c ); // Set v:char
900901 trigger_cmd_autocmd (s -> cmdline_type , EVENT_CMDLINELEAVEPRE );
901902 }
902903
@@ -910,6 +911,7 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
910911 // not readonly:
911912 tv_dict_add_bool (dict , S_LEN ("abort" ),
912913 s -> gotesc ? kBoolVarTrue : kBoolVarFalse );
914+ set_vim_var_char (s -> c ); // Set v:char
913915 TRY_WRAP (& err , {
914916 apply_autocmds (EVENT_CMDLINELEAVE , firstcbuf , firstcbuf , false, curbuf );
915917 // error printed below, to avoid redraw issues
@@ -1361,6 +1363,7 @@ static int command_line_execute(VimState *state, int key)
13611363 // Trigger CmdlineLeavePre autocommand
13621364 if ((KeyTyped && (s -> c == '\n' || s -> c == '\r' || s -> c == K_KENTER || s -> c == ESC ))
13631365 || s -> c == Ctrl_C ) {
1366+ set_vim_var_char (s -> c ); // Set v:char
13641367 trigger_cmd_autocmd (s -> cmdline_type , EVENT_CMDLINELEAVEPRE );
13651368 s -> event_cmdlineleavepre_triggered = true;
13661369 if ((s -> c == ESC || s -> c == Ctrl_C ) && (wim_flags [0 ] & kOptWimFlagList )) {
0 commit comments