From 1f7b977e7568d0759131c5f91459661f3e030691 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 8 Jun 2019 00:20:54 +0200 Subject: diff_corrections: Use better autocmds Thanks to Christian Brabandt (https://vi.stackexchange.com/users/71/christian-brabandt) for describing better autocmds for detecting diff mode: https://vi.stackexchange.com/questions/12847/automatically-disable-cursorline-when-in-diff-mode/12852#12852 And for making the patch (https://github.com/vim/vim/commit/04f62f881c5743d2fdaf7324f6a715381f0d5fcf) that allows diff mode to be detected with the OptionSet event. --- bundle/diff-corrections/plugin/diff_corrections.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bundle/diff-corrections/plugin/diff_corrections.vim') diff --git a/bundle/diff-corrections/plugin/diff_corrections.vim b/bundle/diff-corrections/plugin/diff_corrections.vim index 2cf3abf..393d0f4 100644 --- a/bundle/diff-corrections/plugin/diff_corrections.vim +++ b/bundle/diff-corrections/plugin/diff_corrections.vim @@ -7,7 +7,12 @@ let g:loaded_diff_corrections = 1 augroup diff_corrections autocmd! - autocmd BufEnter * call diff_corrections#Run() + " https://vi.stackexchange.com/questions/12847/automatically-disable-cursorline-when-in-diff-mode/12852#12852 + if has('patch-8.0.0736') + autocmd OptionSet diff call diff_corrections#Run() + else + autocmd BufEnter,FilterWritePost * call diff_corrections#Run() + endif augroup END -- cgit v1.2.3