Skip to content
This repository
Browse code

Allow prototype to be shown with currenttag

  • Loading branch information...
commit d39a7674862e46a2caf2789acf92eee6f14519c5 1 parent a34acf4
Jan Larres authored

Showing 2 changed files with 14 additions and 5 deletions. Show diff stats Hide diff stats

  1. +11 5 autoload/tagbar.vim
  2. +3 0  doc/tagbar.txt
16 autoload/tagbar.vim
@@ -3489,11 +3489,13 @@ endfunction
3489 3489 function! tagbar#currenttag(fmt, default, ...) abort
3490 3490 if a:0 > 0
3491 3491 " also test for non-zero value for backwards compatibility
3492   - let longsig = a:1 =~# 's' || (type(a:1) == type(0) && a:1 != 0)
3493   - let fullpath = a:1 =~# 'f'
  3492 + let longsig = a:1 =~# 's' || (type(a:1) == type(0) && a:1 != 0)
  3493 + let fullpath = a:1 =~# 'f'
  3494 + let prototype = a:1 =~# 'p'
3494 3495 else
3495   - let longsig = 0
3496   - let fullpath = 0
  3496 + let longsig = 0
  3497 + let fullpath = 0
  3498 + let prototype = 0
3497 3499 endif
3498 3500
3499 3501 if !s:Init(1)
@@ -3503,7 +3505,11 @@ function! tagbar#currenttag(fmt, default, ...) abort
3503 3505 let tag = s:GetNearbyTag(0)
3504 3506
3505 3507 if !empty(tag)
3506   - return printf(a:fmt, tag.str(longsig, fullpath))
  3508 + if prototype
  3509 + return tag.getPrototype(1)
  3510 + else
  3511 + return printf(a:fmt, tag.str(longsig, fullpath))
  3512 + endif
3507 3513 else
3508 3514 return a:default
3509 3515 endif
3  doc/tagbar.txt
@@ -611,6 +611,9 @@ tagbar#currenttag({format}, {default} [, {flags}])
611 611 's' If the tag is a function, the complete signature will be shown,
612 612 otherwise just "()" will be appended to distinguish functions from
613 613 other tags.
  614 + 'p' Display the raw prototype instead of the parsed tag. This can be
  615 + useful in cases where ctags doesn't report some information, like
  616 + the signature. Note that this can get quite long.
614 617
615 618 For example, if you put the following into your statusline: >
616 619 %{tagbar#currenttag('[%s] ','')}

0 comments on commit d39a767

Please sign in to comment.
Something went wrong with that request. Please try again.