From bf3a95ebcc00321580ad9437e425a81d15f0dd32 Mon Sep 17 00:00:00 2001 From: David Hegland Date: Tue, 4 Apr 2023 13:46:53 -0500 Subject: [PATCH 1/2] Fix to redirect to NULL to avoid issues when ctags prints error messages --- autoload/tagbar.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 1e623db6..023bb589 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1451,6 +1451,12 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort return '' endif + if &shell =~? 'cmd\.exe' + let ctags_cmd .= ' 2>NUL' + else + let ctags_cmd .= ' 2>/dev/null' + endif + let ctags_output = s:ExecuteCtags(ctags_cmd) if v:shell_error || ctags_output =~? 'Warning: cannot open \(source\|input\) file' From 7f560498404d2613544782e52f4c5bcedd62251f Mon Sep 17 00:00:00 2001 From: David Hegland Date: Tue, 4 Apr 2023 13:47:52 -0500 Subject: [PATCH 2/2] Fix for `s:HandleOnlyWindow()` for vim-9.0. Vim no longer supports closing a window in an autocmd. --- autoload/tagbar.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 023bb589..2019c135 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -3540,13 +3540,17 @@ function! s:HandleOnlyWindow() abort " Before quitting Vim, delete the tagbar buffer so that the '0 mark is " correctly set to the previous buffer. - if tabpagenr('$') == 1 + if !has('patch-9.0.907') && tabpagenr('$') == 1 noautocmd keepalt bdelete endif try try - quit + if has('patch-9.0.907') + call feedkeys(file_open == 2 ? ":quit\:quit\" : ":quit\") + else + quit + endif catch /.*/ " This can be E173 and maybe others call s:OpenWindow('') echoerr v:exception