man.vim: Use page title instead of full path. (#13353)

In commit 63f0ca3263, `tagfunc` was introduced to
`runtime/autoload/man.vim`. Nonetheless the tag function instead
of using a short buffer name (e.g. `man://foo(3)`) uses the full
path to the man page (e.g. `man:///usr/share/.../foo.3.gz`). This
behaviour is inconsistent with `:Man!`, thus this commit.

Closes #13334
This commit is contained in:
shade-of-noon 2020-11-24 04:48:06 -04:00 committed by GitHub
parent 60158dfb81
commit 71d4f5851f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -434,8 +434,11 @@ function! man#goto_tag(pattern, flags, info) abort
let l:structured = [] let l:structured = []
for l:path in l:paths for l:path in l:paths
let l:n = s:extract_sect_and_name_path(l:path)[1] let [l:sect, l:name] = s:extract_sect_and_name_path(l:path)
let l:structured += [{ 'name': l:n, 'path': l:path }] let l:structured += [{
\ 'name': l:name,
\ 'title': l:name . '(' . l:sect . ')'
\ }]
endfor endfor
if &cscopetag if &cscopetag
@ -446,7 +449,7 @@ function! man#goto_tag(pattern, flags, info) abort
return map(l:structured, { return map(l:structured, {
\ _, entry -> { \ _, entry -> {
\ 'name': entry.name, \ 'name': entry.name,
\ 'filename': 'man://' . entry.path, \ 'filename': 'man://' . entry.title,
\ 'cmd': '1' \ 'cmd': '1'
\ } \ }
\ }) \ })