diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 141f6d1..5278e45 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2797,6 +2797,7 @@ function! s:PrintHelp() abort silent put ='\" ' . s:get_map_str('nexttag') . ': Go to next top-level tag' silent put ='\" ' . s:get_map_str('prevtag') . ': Go to previous top-level tag' silent put ='\" ' . s:get_map_str('showproto') . ': Display tag prototype' + silent put ='\" ' . s:get_map_str('hidenonpublic') . ': Hide non-public tags' silent put ='\"' silent put ='\" ---------- Folds ----------' silent put ='\" ' . s:get_map_str('openfold') . ': Open fold' @@ -3654,6 +3655,7 @@ endfunction function! s:ToggleHideNonPublicTags() abort let g:tagbar_hide_nonpublic = !g:tagbar_hide_nonpublic call s:RenderKeepView() + call s:SetStatusLine('current') endfunction " s:IsValidFile() {{{2 @@ -3722,7 +3724,8 @@ function! s:SetStatusLine(current) let &l:statusline = call(g:tagbar_status_func, args) else let colour = current ? '%#StatusLine#' : '%#StatusLineNC#' - let text = colour . '[' . sort . '] ' . fname + let hide = g:tagbar_hide_nonpublic ? '[h] ' : '' + let text = colour . '[' . sort . '] ' . hide . fname let &l:statusline = text endif diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 71aeeba..ee26fed 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -331,6 +331,9 @@ P Open the tag in a |preview-window|. Display the prototype of the current tag (i.e. the line defining it) in the command line. Map option: tagbar_map_showproto +h Hide tags that are declared non-public. Tags without any + visibility information will still be shown. + Map option: tagbar_map_hidenonpublic +/zo Open the fold under the cursor. Map option: tagbar_map_openfold -/zc Close the fold under the cursor or the current one if there is @@ -506,6 +509,19 @@ Example: let g:tagbar_show_linenumbers = 2 < + *g:tagbar_hide_nonpublic* +g:tagbar_hide_nonpublic~ +Default: 0 + +Hide tags that are declared non-public. Tags without any visibility +information will still be shown. This can also be toggled with a key, see +|tagbar-keys|. + +Example: +> + let g:tagbar_hide_nonpublic = 1 +< + *g:tagbar_expand* g:tagbar_expand~ Default: 0