diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index ae03ff3..596a1d6 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1679,7 +1679,7 @@ function! s:OpenWindow(flags) abort if tagbarwinnr != -1 if winnr() != tagbarwinnr && jump call s:winexec(tagbarwinnr . 'wincmd w') - call s:HighlightTag(1, 1, curline) + call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, curline) endif call s:LogDebugMessage("OpenWindow finished, Tagbar already open") return @@ -1722,7 +1722,7 @@ function! s:OpenWindow(flags) abort endif call s:AutoUpdate(curfile, 0) - call s:HighlightTag(1, 1, curline) + call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, curline) if !(g:tagbar_autoclose || autofocus || g:tagbar_autofocus) call s:winexec('wincmd p') @@ -2820,7 +2820,7 @@ function! s:HighlightTag(openfolds, ...) abort return endif - if g:tagbar_autoshowtag || a:openfolds + if g:tagbar_autoshowtag == 1 || a:openfolds call s:OpenParents(tag) endif diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 52172c5..ff2f5d6 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -501,11 +501,14 @@ just choose other characters in that case): g:tagbar_autoshowtag~ Default: 0 -If this variable is set and the current tag is inside of a closed fold then -the folds will be opened as much as needed for the tag to be visible so it can -be highlighted. If it is not set then the folds won't be opened and the parent -tag will be highlighted instead. You can use the |:TagbarShowTag| command to -open the folds manually. +If this variable is set to 1 and the current tag is inside of a closed fold +then the folds will be opened as much as needed for the tag to be visible so +it can be highlighted. If it is set to 0 then the folds will only be opened +when opening the Tagbar window and the current tag is insided a closed fold, +otherwise the folds won't be opened and the parent tag will be highlighted +instead. If it is set to 2 then the folds will never be opened automatically. + +You can use the |:TagbarShowTag| command to open the folds manually. Example: >