Skip to content

Commit

Permalink
Update to handle vim-8 and vim-9 and rework a couple other spots
Browse files Browse the repository at this point in the history
  • Loading branch information
raven42 committed Feb 29, 2024
1 parent 43104f3 commit 89d9949
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions autoload/tagbar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3522,26 +3522,37 @@ function! s:HandleOnlyWindow() abort
let file_open = s:HasOpenFileWindows()

if vim_quitting && file_open == 2 && !g:tagbar_autoclose_netrw
call tagbar#debug#log('Closing Tagbar due to QuitPre - netrw only remaining window')
call s:CloseWindow()
call tagbar#debug#log('Closing Tagbar due to QuitPre - leave netrw')
if has('patch-9.0.907')
call timer_start(10, {-> s:CloseWindow() })
else
call s:CloseWindow()
endif
return
endif

if vim_quitting && file_open != 1
call tagbar#debug#log('Closing Tagbar window due to QuitPre event')
call tagbar#debug#log('Closing Tagbar and netrw due to QuitPre event')
if winnr('$') >= 1
call s:goto_win(tagbarwinnr, 1)
endif

" Before quitting Vim, delete the tagbar buffer so that the '0 mark is
" correctly set to the previous buffer.
if tabpagenr('$') == 1
noautocmd keepalt bdelete
if has('patch-9.0.907')
call timer_start(20, {-> execute('noautocmd keepalt bdelete ' . tagbarwinnr)})
else
noautocmd keepalt bdelete
endif
endif

try
try
call timer_start(0, {-> execute('q', 'silent!') })
if has('patch-9.0.907')
call timer_start(50, {-> execute('q', 'silent!') })
else
quit
endif
catch /.*/ " This can be E173 and maybe others
call s:OpenWindow('')
echoerr v:exception
Expand Down

0 comments on commit 89d9949

Please sign in to comment.