diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 6adf52e..47772ab 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -1619,12 +1619,23 @@ function! s:HighlightTag(fname) " No tag above cursor position so don't do anything if tagline == 0 + if line('$') < winheight(0) - 1 + execute 1 + call winline() + endif execute prevwinnr . 'wincmd w' let &eventignore = eventignore_save redraw return endif + " If the Tagbar contents are shorter than the window height make sure + " that the whole content is shown by jumping to the top of the window + if line('$') < winheight(0) - 1 + execute 1 + call winline() + endif + " Go to the line containing the tag execute tagline