From d39a7674862e46a2caf2789acf92eee6f14519c5 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sun, 9 Sep 2012 20:17:44 +1200 Subject: [PATCH] Allow prototype to be shown with currenttag --- autoload/tagbar.vim | 16 +++++++++++----- doc/tagbar.txt | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index f46b397..e392b99 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -3489,11 +3489,13 @@ endfunction function! tagbar#currenttag(fmt, default, ...) abort 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 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 longsig = 0 + let fullpath = 0 + let prototype = 0 endif if !s:Init(1) @@ -3503,7 +3505,11 @@ function! tagbar#currenttag(fmt, default, ...) abort let tag = s:GetNearbyTag(0) if !empty(tag) - return printf(a:fmt, tag.str(longsig, fullpath)) + if prototype + return tag.getPrototype(1) + else + return printf(a:fmt, tag.str(longsig, fullpath)) + endif else return a:default endif diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 30a3ce8..567c308 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -611,6 +611,9 @@ tagbar#currenttag({format}, {default} [, {flags}]) 's' If the tag is a function, the complete signature will be shown, otherwise just "()" will be appended to distinguish functions from other tags. + '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. For example, if you put the following into your statusline: > %{tagbar#currenttag('[%s] ','')}