Use correct filename in auto commands.

This problem was revealed when using BufExplorer:

- Open vim with two files: `$ vim a.txt b.txt`
- Type `\\` to open BufExplorer.
- Press <enter> on `b.txt`.
- Vim shows `b.txt` as expected.
- Type `\\` to open BufExplorer.
- Press <enter> on `a.txt`.
- Expected: Vim shows `a.txt`.
  Actual Vim shows `a.txt`, `b.txt`, `a.txt`.

I.e. the first invocation was fine but all subsequent invocations
rapidly flicked through <new file>, <old file>, <new file>.
This commit is contained in:
Andy Stewart
2013-04-12 13:17:05 +02:00
parent d4a1a60f39
commit 25d428c390

View File

@@ -533,9 +533,9 @@ endfunction
augroup gitgutter
autocmd!
if g:gitgutter_on_bufenter
autocmd BufEnter,BufWritePost,FileWritePost * call GitGutter(s:current_file())
autocmd BufEnter,BufWritePost,FileWritePost * call GitGutter(expand('<afile>'))
else
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter(s:current_file())
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter(expand('<afile>'))
endif
if g:gitgutter_all_on_focusgained
if !has('gui_win32')