From 5b563a0d2deee5b533d53e10b3b39fcc8578db42 Mon Sep 17 00:00:00 2001 From: Martin Vuille Date: Fri, 16 Dec 2016 16:08:28 -0500 Subject: [PATCH] HandleBufDelete: Ignore apparent 'set nobuflisted' events --- autoload/tagbar.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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