From 3566907b5754f2a4d1043616187b016e8ad5248a Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sat, 15 Oct 2016 20:20:03 +1300 Subject: [PATCH] Only use QuitPre functionality if supported, closes #350 The QuitPre autocommand was introduced in Vim version 7.3.544. If Vim is older than this then don't use the HandleOnlyWindow() functionality, so in the case of closing the last window in a tab a user will have to close the Tagbar window themselves. --- autoload/tagbar.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index e9c3f8a..aef425e 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1044,7 +1044,9 @@ function! s:CreateAutocommands() abort autocmd BufEnter * if expand('') !~ '__Tagbar__.*' | \ let s:last_alt_bufnr = bufnr('#') | \ endif - autocmd QuitPre * let s:vim_quitting = 1 + if exists('##QuitPre') + autocmd QuitPre * let s:vim_quitting = 1 + endif autocmd WinEnter * nested call s:HandleOnlyWindow() autocmd WinEnter * if bufwinnr(s:TagbarBufName()) == -1 | \ call s:ShrinkIfExpanded() |