diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 639f194..fe255f9 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -967,6 +967,10 @@ function! s:CreateAutocommands() abort autocmd WinEnter __Tagbar__ call s:SetStatusLine('current') autocmd WinLeave __Tagbar__ call s:SetStatusLine('noncurrent') + if g:tagbar_autopreview + autocmd CursorMoved __Tagbar__ nested call s:ShowInPreviewWin() + endif + autocmd WinEnter * if bufwinnr('__Tagbar__') == -1 | \ call s:ShrinkIfExpanded() | \ endif diff --git a/doc/tagbar.txt b/doc/tagbar.txt index ab99afc..27cb2c5 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -564,6 +564,18 @@ Example: let g:tagbar_autoshowtag = 1 < + *g:tagbar_autopreview* +g:tagbar_autopreview~ +Default: 0 + +If this variable is set to 1 then moving the cursor in the Tagbar window will +automatically show the current tag in the preview window. + +Example: +> + let g:tagbar_autopreview = 1 +< + *g:tagbar_updateonsave_maxlines* g:tagbar_updateonsave_maxlines~ diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 4e2e21a..22293d8 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -51,6 +51,7 @@ endfunction let s:options = [ \ ['autoclose', 0], \ ['autofocus', 0], + \ ['autopreview', 0], \ ['autoshowtag', 0], \ ['compact', 0], \ ['expand', 0],