diff --git a/autoload/tagbar/prototypes/basetag.vim b/autoload/tagbar/prototypes/basetag.vim index 009054fb..2412b038 100644 --- a/autoload/tagbar/prototypes/basetag.vim +++ b/autoload/tagbar/prototypes/basetag.vim @@ -84,7 +84,7 @@ endfunction function! s:_getPrefix() abort dict let fileinfo = self.fileinfo - if !empty(self._childlist) + if !empty(self._childlist) && g:tagbar_show_prefix == 1 if fileinfo.tagfolds[self.fields.kind][self.fullpath] let prefix = g:tagbar#icon_closed else @@ -95,9 +95,9 @@ function! s:_getPrefix() abort dict endif " Visibility is called 'access' in the ctags output if g:tagbar_show_visibility - if has_key(self.fields, 'access') + if has_key(self.fields, 'access') && g:tagbar_show_prefix == 1 let prefix .= get(s:visibility_symbols, self.fields.access, ' ') - elseif has_key(self.fields, 'file') + elseif has_key(self.fields, 'file') && g:tagbar_show_prefix == 1 let prefix .= s:visibility_symbols.private else let prefix .= ' ' diff --git a/autoload/tagbar/prototypes/normaltag.vim b/autoload/tagbar/prototypes/normaltag.vim index a5916d26..ec106b95 100644 --- a/autoload/tagbar/prototypes/normaltag.vim +++ b/autoload/tagbar/prototypes/normaltag.vim @@ -28,21 +28,26 @@ endfunction function! s:strfmt() abort dict let typeinfo = self.typeinfo - let suffix = get(self.fields, 'signature', '') - if has_key(self.fields, 'type') - let suffix .= ' : ' . self.fields.type - elseif has_key(get(typeinfo, 'kind2scope', {}), self.fields.kind) - let scope = s:maybe_map_scope(typeinfo.kind2scope[self.fields.kind]) - if !g:tagbar_show_data_type - let suffix .= ' : ' . scope + if g:tagbar_show_suffix == 1 + let suffix = get(self.fields, 'signature', '') + if has_key(self.fields, 'type') + let suffix .= ' : ' . self.fields.type + elseif has_key(get(typeinfo, 'kind2scope', {}), self.fields.kind) + let scope = s:maybe_map_scope(typeinfo.kind2scope[self.fields.kind]) + if !g:tagbar_show_data_type + let suffix .= ' : ' . scope + endif endif - endif - let prefix = self._getPrefix() - if g:tagbar_show_data_type && self.getDataType() !=# '' - let suffix .= ' : ' . self.getDataType() + if g:tagbar_show_data_type && self.getDataType() !=# '' + let suffix .= ' : ' . self.getDataType() + endif + else + let suffix = '' endif + let prefix = self._getPrefix() + if g:tagbar_show_tag_linenumbers == 1 let suffix .= ' [' . self.fields.line . ']' elseif g:tagbar_show_tag_linenumbers == 2 diff --git a/doc/tagbar.txt b/doc/tagbar.txt index ca871ea3..d06b2e14 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -820,6 +820,37 @@ Possible values are: Example: > let g:tagbar_show_linenumbers = 2 +< + *g:tagbar_show_prefix* +g:tagbar_show_prefix~ +Default: 1 + +Controls if the prefix information is shown before the tag. The prefix info is +usually defined as the variable scope. For example, if a variable is private +scope only, then a '-' symbol will be used by default. + +Possible values are: + 0: Don't show the prefix. + 1: Show the prefix. + +Example: +> + let g:tagbar_show_prefix = 0 +< + *g:tagbar_show_suffix* +g:tagbar_show_suffix~ +Default: 1 + +Controls if the suffix information is shown after the tag. The suffix info is +usually data type. + +Possible values are: + 0: Don't show the suffix. + 1: Show the suffix. + +Example: +> + let g:tagbar_show_suffix = 0 < *g:tagbar_show_tag_linenumbers* g:tagbar_show_tag_linenumbers~ diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 0271d19e..62e467a2 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -113,6 +113,8 @@ function! s:setup_options() abort \ ['show_data_type', 0], \ ['show_visibility', 1], \ ['show_linenumbers', 0], + \ ['show_prefix', 1], + \ ['show_suffix', 1], \ ['show_tag_count', 0], \ ['show_tag_linenumbers', 0], \ ['singleclick', 0],