Fix autocommands so GitGutter doesn't run twice on file read.

This commit is contained in:
Andy Stewart
2013-03-18 16:09:40 +01:00
parent 21a27e05b2
commit 7f1c104f9f
2 changed files with 4 additions and 1 deletions

View File

@@ -143,6 +143,8 @@ This is on by default but causes a noticeable lag for some people. To turn it o
let g:gitgutter_on_bufenter = 0 let g:gitgutter_on_bufenter = 0
``` ```
If you turn it off, vim-gitgutter will instead run every time you read or write a buffer.
#### To stop vim-gitgutter running for all buffers on `FocusGained` #### To stop vim-gitgutter running for all buffers on `FocusGained`

View File

@@ -507,9 +507,10 @@ endfunction
augroup gitgutter augroup gitgutter
autocmd! autocmd!
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter(s:current_file())
if g:gitgutter_on_bufenter if g:gitgutter_on_bufenter
autocmd BufEnter * call GitGutter(s:current_file()) autocmd BufEnter * call GitGutter(s:current_file())
else
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter(s:current_file())
endif endif
if g:gitgutter_all_on_focusgained && !has('gui_win32') if g:gitgutter_all_on_focusgained && !has('gui_win32')
autocmd FocusGained * call GitGutterAll() autocmd FocusGained * call GitGutterAll()