patch 8.2.3430: no generic way to trigger an autocommand on mode change
Problem: No generic way to trigger an autocommand on mode change.
Solution: Add the ModeChanged autocommand event. (Magnus Gross, closes #8856)
diff --git a/src/normal.c b/src/normal.c
index 6620af9..8a4e778 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1386,6 +1386,7 @@
#endif
VIsual_active = FALSE;
+ trigger_modechanged();
setmouse();
mouse_dragging = 0;
@@ -5642,6 +5643,7 @@
{ // or char/line mode
VIsual_mode = cap->cmdchar;
showmode();
+ trigger_modechanged();
}
redraw_curbuf_later(INVERTED); // update the inversion
}
@@ -5757,6 +5759,7 @@
VIsual_mode = c;
VIsual_active = TRUE;
VIsual_reselect = TRUE;
+ trigger_modechanged();
// Corner case: the 0 position in a tab may change when going into
// virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting.