From 3188ab1ee81dc9da46f2291a5123531ea00b0ea8 Mon Sep 17 00:00:00 2001 From: magras Date: Tue, 11 Jan 2022 19:41:32 +0300 Subject: [PATCH] use g:tagbar_highlight_method as default in tagbar#currenttag and forward search method from :TagbarCurrentTag (#803) * allow to specify {search-method} in :TagbarCurrentTag command * tagbar#currenttag now uses g:tagbar_highlight_method as default search method --- autoload/tagbar.vim | 4 ++-- doc/tagbar.txt | 6 +++--- plugin/tagbar.vim | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index e8f9dc6..51865f0 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -3901,13 +3901,13 @@ function! tagbar#currenttag(fmt, default, ...) abort if a:0 >= 2 let search_method = a:2 else - let search_method = 'nearest-stl' + let search_method = g:tagbar_highlight_method endif else let longsig = 0 let fullpath = 0 let prototype = 0 - let search_method = 'nearest-stl' + let search_method = g:tagbar_highlight_method endif if !s:Init(1) diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 74e54ea..9b36754 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -295,9 +295,9 @@ COMMANDS *tagbar-commands* Open the parent folds of the current tag in the file window as much as needed for the tag to be visible in the Tagbar window. -:TagbarCurrentTag [{flags}] *:TagbarCurrentTag* - Echo the current tag in the command line. For {flags} see - |tagbar-statusline|. +:TagbarCurrentTag [{flags} [{search-method}]] *:TagbarCurrentTag* + Echo the current tag in the command line. For {flags} and {search-method} + see |tagbar-statusline|. :TagbarGetTypeConfig {filetype} *:TagbarGetTypeConfig* Paste the Tagbar configuration of the vim filetype {filetype} at the diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 3c00b40..7243965 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -190,7 +190,7 @@ command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fcj') command! -nargs=0 TagbarClose call tagbar#CloseWindow() command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(, 0) command! -nargs=0 TagbarShowTag call tagbar#highlighttag(1, 1) -command! -nargs=? TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', ) +command! -nargs=* TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', ) command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig() command! -nargs=? TagbarDebug call tagbar#debug#start_debug() command! -nargs=0 TagbarDebugEnd call tagbar#debug#stop_debug()