aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pilling <robpilling@gmail.com>2020-01-07 05:57:36 +0000
committerJustin M. Keyes <justinkz@gmail.com>2020-01-06 21:57:36 -0800
commit4a7d84ae603f75f974ab9a9d2f4d1b4a06da79bf (patch)
treee3a08129abaea1910bceac2f337da24498a5f383
parent83b0054b87f82583873a6e7ef291507c580618b1 (diff)
downloadrneovim-4a7d84ae603f75f974ab9a9d2f4d1b4a06da79bf.tar.gz
rneovim-4a7d84ae603f75f974ab9a9d2f4d1b4a06da79bf.tar.bz2
rneovim-4a7d84ae603f75f974ab9a9d2f4d1b4a06da79bf.zip
man.vim: workaround for 'cscopetag' #11679
The old `:Man` implementation would take either the word under the cursor, or the argument passed in, and load that as a man page. Since we now use 'tagfunc' and look for all relevant man-pages, if your system has several (i.e. same name, different sections), we return several, giving the user an option. This works for most tag commands except `:tjump`, which will fail if there's multiple tags to choose from. This just happens to be what the cscope code uses (it actually attempts to prompt the user, but this fails).
-rw-r--r--runtime/autoload/man.vim5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index e4c0080ae9..5feab0ce70 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -398,6 +398,11 @@ function! man#goto_tag(pattern, flags, info) abort
" sort by relevance - exact matches first, then the previous order
call sort(l:structured, { a, b -> a.name ==? l:name ? -1 : b.name ==? l:name ? 1 : 0 })
+ if &cscopetag
+ " return only a single entry so we work well with :cstag (#11675)
+ let l:structured = l:structured[:0]
+ endif
+
return map(l:structured, {
\ _, entry -> {
\ 'name': entry.name,