mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-23 08:19:50 +08:00
Don't try to restore session on 'loadview', closes #382
The view files created with the 'mkview' command run the 'SessionLoadPost' autocommand at the end, which creates problems if Tagbar has alread been initialized. Add a new variable so that we can detect this situation.
This commit is contained in:
parent
959f487981
commit
87a1263f5d
|
@ -51,6 +51,7 @@ let s:icon_open = g:tagbar_iconchars[1]
|
|||
let s:type_init_done = 0
|
||||
let s:autocommands_done = 0
|
||||
let s:statusline_in_use = 0
|
||||
let s:init_done = 0
|
||||
|
||||
" 0: not checked yet; 1: checked and found; 2: checked and not found
|
||||
let s:checked_ctags = 0
|
||||
|
@ -122,6 +123,7 @@ function! s:Init(silent) abort
|
|||
call s:AutoUpdate(fnamemodify(expand('%'), ':p'), 0)
|
||||
endif
|
||||
|
||||
let s:init_done = 1
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
|
@ -967,6 +969,11 @@ endfunction
|
|||
" s:RestoreSession() {{{2
|
||||
" Properly restore Tagbar after a session got loaded
|
||||
function! s:RestoreSession() abort
|
||||
if s:init_done
|
||||
call s:debug('Tagbar already initialized; not restoring session')
|
||||
return
|
||||
endif
|
||||
|
||||
call s:debug('Restoring session')
|
||||
|
||||
let curfile = fnamemodify(bufname('%'), ':p')
|
||||
|
@ -975,12 +982,12 @@ function! s:RestoreSession() abort
|
|||
if tagbarwinnr == -1
|
||||
" Tagbar wasn't open in the saved session, nothing to do
|
||||
return
|
||||
else
|
||||
let in_tagbar = 1
|
||||
if winnr() != tagbarwinnr
|
||||
call s:goto_win(tagbarwinnr)
|
||||
let in_tagbar = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
let in_tagbar = 1
|
||||
if winnr() != tagbarwinnr
|
||||
call s:goto_win(tagbarwinnr, 1)
|
||||
let in_tagbar = 0
|
||||
endif
|
||||
|
||||
let s:last_autofocus = 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user