From 4a7d84ae603f75f974ab9a9d2f4d1b4a06da79bf Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Tue, 7 Jan 2020 05:57:36 +0000 Subject: [PATCH] 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). --- runtime/autoload/man.vim | 5 +++++ 1 file changed, 5 insertions(+) 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,