diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 498a4a1..8032cac 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1076,7 +1076,7 @@ function! s:CreateAutocommands() abort autocmd BufReadPost,BufEnter,CursorHold,FileType * call \ s:AutoUpdate(fnamemodify(expand(''), ':p'), 0) autocmd BufDelete,BufWipeout * - \ nested call s:HandleBufDelete(expand('')) + \ nested call s:HandleBufDelete(expand(''), expand('')) " Suspend Tagbar while grep commands are running, since we don't want " to process files that only get loaded temporarily to search them @@ -4159,7 +4159,13 @@ function! s:HandleOnlyWindow() abort endfunction " s:HandleBufDelete() {{{2 -function! s:HandleBufDelete(bufname) abort +function! s:HandleBufDelete(bufname, bufnr) abort + " Ignore autocmd events generated for "set nobuflisted", + let nr = +a:bufnr " bufnr is passed as a string + if bufexists(nr) && !buflisted(nr) + return + endif + let tagbarwinnr = bufwinnr(s:TagbarBufName()) if tagbarwinnr == -1 || a:bufname =~ '__Tagbar__.*' return