From f4b2053f6e342ce76a154e0b22f2d42211bf9126 Mon Sep 17 00:00:00 2001 From: NTCong <ntcong.it@gmail.com> Date: Fri, 29 Sep 2017 09:39:56 +0700 Subject: [PATCH] only set autocmd once for write command checking --- plugin/magit.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/magit.vim b/plugin/magit.vim index ac3e28f..dfc06a3 100644 --- a/plugin/magit.vim +++ b/plugin/magit.vim @@ -807,6 +807,8 @@ function! magit#show_magit(display, ...) let &l:foldlevel = b:magit_default_fold_level setlocal filetype=magit + augroup vimagit_buffer + autocmd! " catch write command execute "autocmd BufWriteCmd " . buffer_name . " :call magit#commit_command('CC')" @@ -823,6 +825,7 @@ function! magit#show_magit(display, ...) \ b:magit_current_commit_mode != '' ) | \ call s:set_mode_read() | \ endif" + augroup END let b:state = deepcopy(g:magit#state#state) " s:magit_commit_mode: global variable which states in which commit mode we are -- GitLab