man.vim: lowercase title when invoked as $MANPAGER

man#init_pager() guesses the ref by the heading, which is usually
uppercase, so we don't know the correct casing. But lowercase is more
common, so use that for the buffer name instead of uppercase.

ref #9156
This commit is contained in:
Justin M. Keyes 2018-10-26 02:50:21 +02:00
parent 4d7c7f96dd
commit 112a5b76e6

View File

@ -392,8 +392,8 @@ function! man#init_pager() abort
keepjumps 1
endif
lua require("man").highlight_man_page()
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
" all caps it is impossible to tell what the original capitilization was.
" Guess the ref from the heading (which is usually uppercase, so we cannot
" know the correct casing, cf. `man glDrawArraysInstanced`).
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')
try
let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
@ -401,7 +401,7 @@ function! man#init_pager() abort
let b:man_sect = ''
endtry
if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95.
execute 'silent file man://'.fnameescape(ref)
execute 'silent file man://'.tolower(fnameescape(ref))
endif
endfunction