1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-18 03:50:26 +01:00

Add g:tagbar_scopestrs (#661)

Allows mapping scope suffixes (e.g. 'function') to user-defined values.
This commit is contained in:
Luis Piloto
2020-09-23 11:02:34 +01:00
committed by GitHub
parent 1caa71aca3
commit 5339b4e8bd
3 changed files with 44 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
function! s:maybe_map_scope(scopestr) abort
if !empty(g:tagbar_scopestrs)
if has_key(g:tagbar_scopestrs, a:scopestr)
return g:tagbar_scopestrs[a:scopestr]
endif
endif
return a:scopestr
endfunction
function! tagbar#prototypes#normaltag#new(name) abort
let newobj = tagbar#prototypes#basetag#new(a:name)
@@ -22,7 +31,8 @@ function! s:strfmt() abort dict
if has_key(self.fields, 'type')
let suffix .= ' : ' . self.fields.type
elseif has_key(get(typeinfo, 'kind2scope', {}), self.fields.kind)
let suffix .= ' : ' . typeinfo.kind2scope[self.fields.kind]
let scope = s:maybe_map_scope(typeinfo.kind2scope[self.fields.kind])
let suffix .= ' : ' . scope
endif
return self._getPrefix() . self.name . suffix