diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-11-02 02:11:22 -0500 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-11-07 19:02:52 -0500 |
commit | 24db59ca8fc6f2f5f96ad71d83c265170bc341db (patch) | |
tree | dbeaeeec0ceab6e27d47bf42c8acedb4e7543014 /src/nvim/normal.c | |
parent | 643f4a178751df34b27189f7aebea313b17bad3b (diff) | |
download | rneovim-24db59ca8fc6f2f5f96ad71d83c265170bc341db.tar.gz rneovim-24db59ca8fc6f2f5f96ad71d83c265170bc341db.tar.bz2 rneovim-24db59ca8fc6f2f5f96ad71d83c265170bc341db.zip |
feat: implement BufModified autocmd
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 771ca732f4..1362e95ee0 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1229,6 +1229,16 @@ static void normal_check_text_changed(NormalState *s) } } +static void normal_check_buffer_modified(NormalState *s) +{ + // Trigger BufModified if b_modified changed + if (!finish_op && has_event(EVENT_BUFMODIFIED) + && curbuf->b_changed_notified == false) { + apply_autocmds(EVENT_BUFMODIFIED, NULL, NULL, false, curbuf); + curbuf->b_changed_notified = true; + } +} + static void normal_check_folds(NormalState *s) { // Include a closed fold completely in the Visual area. @@ -1336,6 +1346,7 @@ static int normal_check(VimState *state) normal_check_cursor_moved(s); normal_check_text_changed(s); normal_check_window_scrolled(s); + normal_check_buffer_modified(s); // Updating diffs from changed() does not always work properly, // esp. updating folds. Do an update just before redrawing if |