Skip to content

Commit

Permalink
Fixes 845: Call init on update (#897)
Browse files Browse the repository at this point in the history
If tagbar is not yet initialized, then initialize it upon call to `Update() | jump() | jumpToNearbyTag()`. This will ensure that we have loaded the file.
  • Loading branch information
raven42 authored Dec 27, 2024
1 parent 5e090da commit 8de7694
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions autoload/tagbar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3834,6 +3834,9 @@ endfunction
" tagbar#Update() {{{2
" Trigger an AutoUpdate() of the currently opened file
function! tagbar#Update() abort
if s:init_done == 0
call s:Init(0)
endif
call s:AutoUpdate(fnamemodify(expand('%'), ':p'), 0)
endfunction

Expand Down Expand Up @@ -4096,6 +4099,9 @@ endfunction

" tagbar#jump() {{{2
function! tagbar#jump() abort
if s:init_done == 0
call tagbar#Update()
endif
if &filetype !=# 'tagbar'
" Not in tagbar window - ignore this function call
return
Expand All @@ -4110,6 +4116,9 @@ endfun
" [flags] = list of flags (as a string) to control behavior
" 's' - use the g:tagbar_scroll_offset setting when jumping
function! tagbar#jumpToNearbyTag(direction, ...) abort
if s:init_done == 0
call tagbar#Update()
endif
let search_method = a:0 >= 1 ? a:1 : 'nearest-stl'
let flags = a:0 >= 2 ? a:2 : ''

Expand Down

0 comments on commit 8de7694

Please sign in to comment.