diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-22 23:44:57 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-17 20:23:05 -0400 |
commit | aa681df25fc1b1c22182c8150e53952fefa63e10 (patch) | |
tree | b998bf10d9ba4c08b5e75e69f3e9c85d29794fc3 /src/nvim/ex_cmds2.c | |
parent | 452ec4ed31d5d9c9ab4af9d8e686182ae11cef0c (diff) | |
download | rneovim-aa681df25fc1b1c22182c8150e53952fefa63e10.tar.gz rneovim-aa681df25fc1b1c22182c8150e53952fefa63e10.tar.bz2 rneovim-aa681df25fc1b1c22182c8150e53952fefa63e10.zip |
vim-patch:8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Problem: There is a SourcePre autocommand event but not a SourcePost.
Solution: Add the SourcePost autocommand event. (closes vim/vim#3739)
https://github.com/vim/vim/commit/2b6185287adf53343ed5f49e967ae402c64063e4
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 2fb818760a..71c9290027 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3039,6 +3039,7 @@ int do_source(char_u *fname, int check_other, int is_vimrc) int save_debug_break_level = debug_break_level; scriptitem_T *si = NULL; proftime_T wait_start; + bool trigger_source_post = false; p = expand_env_save(fname); if (p == NULL) { @@ -3059,6 +3060,10 @@ int do_source(char_u *fname, int check_other, int is_vimrc) && apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp, false, curbuf)) { retval = aborting() ? FAIL : OK; + if (retval == OK) { + // Apply SourcePost autocommands. + apply_autocmds(EVENT_SOURCEPOST, fname_exp, fname_exp, false, curbuf); + } goto theend; } @@ -3261,6 +3266,10 @@ int do_source(char_u *fname, int check_other, int is_vimrc) time_pop(rel_time); } + if (!got_int) { + trigger_source_post = true; + } + // After a "finish" in debug mode, need to break at first command of next // sourced file. if (save_debug_break_level > ex_nesting_level @@ -3278,6 +3287,10 @@ int do_source(char_u *fname, int check_other, int is_vimrc) xfree(firstline); convert_setup(&cookie.conv, NULL, NULL); + if (trigger_source_post) { + apply_autocmds(EVENT_SOURCEPOST, si->sn_name, si->sn_name, false, curbuf); + } + theend: xfree(fname_exp); return retval; |