Skip to content

Commit 8de7694

Browse files
authored
Fixes 845: Call init on update (#897)
If tagbar is not yet initialized, then initialize it upon call to `Update() | jump() | jumpToNearbyTag()`. This will ensure that we have loaded the file.
1 parent 5e090da commit 8de7694

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

autoload/tagbar.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,6 +3834,9 @@ endfunction
38343834
" tagbar#Update() {{{2
38353835
" Trigger an AutoUpdate() of the currently opened file
38363836
function! tagbar#Update() abort
3837+
if s:init_done == 0
3838+
call s:Init(0)
3839+
endif
38373840
call s:AutoUpdate(fnamemodify(expand('%'), ':p'), 0)
38383841
endfunction
38393842

@@ -4096,6 +4099,9 @@ endfunction
40964099

40974100
" tagbar#jump() {{{2
40984101
function! tagbar#jump() abort
4102+
if s:init_done == 0
4103+
call tagbar#Update()
4104+
endif
40994105
if &filetype !=# 'tagbar'
41004106
" Not in tagbar window - ignore this function call
41014107
return
@@ -4110,6 +4116,9 @@ endfun
41104116
" [flags] = list of flags (as a string) to control behavior
41114117
" 's' - use the g:tagbar_scroll_offset setting when jumping
41124118
function! tagbar#jumpToNearbyTag(direction, ...) abort
4119+
if s:init_done == 0
4120+
call tagbar#Update()
4121+
endif
41134122
let search_method = a:0 >= 1 ? a:1 : 'nearest-stl'
41144123
let flags = a:0 >= 2 ? a:2 : ''
41154124

0 commit comments

Comments
 (0)