mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 19:40:27 +01:00
Display the kind (type) of the tag on the status bar.
Besides the usual tag hierarchy, type of the tag would be provided.
This commit is contained in:
@@ -1400,7 +1400,7 @@ function! s:NormalTag.strfmt() abort dict
|
||||
endfunction
|
||||
|
||||
" s:NormalTag.str() {{{3
|
||||
function! s:NormalTag.str(longsig, full) abort dict
|
||||
function! s:NormalTag.str(longsig, full, showkind) abort dict
|
||||
if a:full && self.path != ''
|
||||
let str = self.path . self.typeinfo.sro . self.name
|
||||
else
|
||||
@@ -1413,6 +1413,10 @@ function! s:NormalTag.str(longsig, full) abort dict
|
||||
else
|
||||
let str .= '()'
|
||||
endif
|
||||
elseif a:showkind
|
||||
let str .= ' (' .
|
||||
\ self.fileinfo.typeinfo.kind2scope[self.fields.kind] .
|
||||
\ ')'
|
||||
endif
|
||||
|
||||
return str
|
||||
@@ -4182,16 +4186,20 @@ function! tagbar#currenttag(fmt, default, ...) abort
|
||||
" Indicate that the statusline functionality is being used. This prevents
|
||||
" the CloseWindow() function from removing the autocommands.
|
||||
let s:statusline_in_use = 1
|
||||
let longsig = 0
|
||||
let fullpath = 0
|
||||
let prototype = 0
|
||||
let showkind = 0
|
||||
|
||||
if a:0 > 0
|
||||
" also test for non-zero value for backwards compatibility
|
||||
let longsig = a:1 =~# 's' || (type(a:1) == type(0) && a:1 != 0)
|
||||
let fullpath = a:1 =~# 'f'
|
||||
let prototype = a:1 =~# 'p'
|
||||
else
|
||||
let longsig = 0
|
||||
let fullpath = 0
|
||||
let prototype = 0
|
||||
if a:1 =~# 'k'
|
||||
let showkind = 1
|
||||
let fullpath = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
if !s:Init(1)
|
||||
@@ -4204,7 +4212,7 @@ function! tagbar#currenttag(fmt, default, ...) abort
|
||||
if prototype
|
||||
return tag.getPrototype(1)
|
||||
else
|
||||
return printf(a:fmt, tag.str(longsig, fullpath))
|
||||
return printf(a:fmt, tag.str(longsig, fullpath, showkind))
|
||||
endif
|
||||
else
|
||||
return a:default
|
||||
|
||||
@@ -828,6 +828,9 @@ tagbar#currenttag({format}, {default} [, {flags}])
|
||||
'p' Display the raw prototype instead of the parsed tag. This can be
|
||||
useful in cases where ctags doesn't report some information, like
|
||||
the signature. Note that this can get quite long.
|
||||
'k' This is essentially the same as in 'f' flag - it will display the
|
||||
full hierarchy of the tag, and additionally will provide the
|
||||
information of the kind of the tag.
|
||||
|
||||
For example, if you put the following into your statusline: >
|
||||
%{tagbar#currenttag('[%s] ','')}
|
||||
|
||||
Reference in New Issue
Block a user