From 469c4b3188afd1825cb2756b9e159cef7fd59a53 Mon Sep 17 00:00:00 2001 From: raven42 Date: Tue, 27 Oct 2020 09:18:30 -0500 Subject: [PATCH] Add g:tagbar_show_tag_count option (#685) * Add g:tagbar_show_tag_count option Closes #290 This option will show the tag kind count next to the kind label in the tagbar window. * Address review comments --- autoload/tagbar.vim | 7 ++++++- doc/tagbar.txt | 12 ++++++++++++ plugin/tagbar.vim | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 1b7a639..0d4bba3 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1967,7 +1967,12 @@ function! s:PrintKinds(typeinfo, fileinfo) abort endif let padding = g:tagbar_show_visibility ? ' ' : '' - call add(output, foldmarker . padding . kind.long) + if g:tagbar_show_tag_count + let tag_count = ' (' . len(curtags) . ')' + call add(output, foldmarker . padding . kind.long . tag_count) + else + call add(output, foldmarker . padding . kind.long) + endif let curline = len(output) + offset let kindtag.tline = curline diff --git a/doc/tagbar.txt b/doc/tagbar.txt index a096eb6..f100076 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -718,6 +718,18 @@ window. It can be set to the following values: Example: > let g:tagbar_show_tag_linenumbers = 1 +< + *g:tagbar_show_tag_count* +g:tagbar_show_tag_count~ +Default: 0 + +This option allows showing the tag count next to the tag kind in the tagbar +window. This will show up like this > + > functions () +< +Example: +> + let g:tagbar_show_tag_count = 1 < *g:tagbar_hide_nonpublic* g:tagbar_hide_nonpublic~ diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 1f48d3b..40eb9b6 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -103,6 +103,7 @@ function! s:setup_options() abort \ ['show_balloon', 1], \ ['show_visibility', 1], \ ['show_linenumbers', 0], + \ ['show_tag_count', 0], \ ['show_tag_linenumbers', 0], \ ['singleclick', 0], \ ['sort', 1],