diff options
Diffstat (limited to 'src/nvim/autocmd.c')
-rw-r--r-- | src/nvim/autocmd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index ae81b6a808..490fe5a0ac 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -925,6 +925,13 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, c return FAIL; } } + + // need to initialize last_mode for the first ModeChanged autocmd + if (event == EVENT_MODECHANGED && !has_event(EVENT_MODECHANGED)) { + xfree(last_mode); + last_mode = get_mode(); + } + ap->cmds = NULL; *prev_ap = ap; last_autopat[(int)event] = ap; |