From 8da5b64868d4c54a4ee4e1d08d148da0f0fdb10f Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Mon, 12 Feb 2018 16:02:03 +0000 Subject: [PATCH] Avoid autocmds when switching buffers to write temp file. --- autoload/gitgutter/diff.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index 1b2186f..4544cde 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -293,7 +293,7 @@ function! s:write_buffer(bufnr, file) " There doesn't seem to be a clean way to write a buffer that isn't the current " to a file; we have to switch to it, write it, then switch back. let current_buffer = bufnr('') - execute 'buffer' a:bufnr + execute 'noautocmd buffer' a:bufnr " Writing the whole buffer resets the '[ and '] marks and also the " 'modified' flag (if &cpoptions includes '+'). These are unwanted @@ -308,7 +308,7 @@ function! s:write_buffer(bufnr, file) call setpos("'[", op_mark_start) call setpos("']", op_mark_end) - execute 'buffer' current_buffer + execute 'noautocmd buffer' current_buffer endfunction