diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index eac9f4a..2785447 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1281,6 +1281,11 @@ function! s:ProcessFile(fname, ftype) abort if line =~# '^!_TAG_' || has_key(seen, line) continue endif + if g:tagbar_ignore_anonymous && line =~# '__anon' + call tagbar#debug#log('anonymous tag found - ignoring per tagbar configuration') + continue + endif + let seen[line] = 1 let parts = split(line, ';"') diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 15c0460..cb29435 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -1140,6 +1140,17 @@ highlight the 'SOME_MACRO' tag. Example: > let g:tagbar_highlight_method = 'nearest' < + *g:tagbar_ignore_anonymous* +g:tagbar_ignore_anonymous~ +Default: 0 + +If set, any '__anon' tags generated by ctags will be ignored and will not be +displayed in the tagbar window. Note: this will also mean any child tags of +that anonymous tag will also not be visible. + +Example: > + let g:tagbar_ignore_anonymous = 1 +< ------------------------------------------------------------------------------ HIGHLIGHT COLOURS *tagbar-highlight* diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 9c401fe..75c1a00 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -101,6 +101,7 @@ function! s:setup_options() abort \ ['left', 0], \ ['help_visibility', 0], \ ['highlight_method', 'nearest-stl'], + \ ['ignore_anonymous', 0], \ ['position', default_pos], \ ['previewwin_pos', previewwin_pos], \ ['scopestrs', {}],