mirror of
https://github.com/neovim/neovim.git
synced 2025-11-07 11:14:26 +00:00
man.vim: more robust s:verify_exists #6043
Closes #6039 Also: close the window if we could not get the page from man but only if we opened it ourselves.
This commit is contained in:
committed by
Justin M. Keyes
parent
6d4e08d226
commit
3d3b1641d0
@@ -55,7 +55,10 @@ function! man#open_page(count, count1, mods, ...) abort
|
|||||||
try
|
try
|
||||||
let page = s:get_page(path)
|
let page = s:get_page(path)
|
||||||
catch
|
catch
|
||||||
|
if a:mods =~# 'tab' || !s:find_man()
|
||||||
|
" a new window was opened
|
||||||
close
|
close
|
||||||
|
endif
|
||||||
call s:error(v:exception)
|
call s:error(v:exception)
|
||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
@@ -175,13 +178,15 @@ function! s:get_path(sect, name) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:verify_exists(sect, name) abort
|
function! s:verify_exists(sect, name) abort
|
||||||
|
try
|
||||||
let path = s:get_path(a:sect, a:name)
|
let path = s:get_path(a:sect, a:name)
|
||||||
if path !~# '^\/'
|
catch /^command error (/
|
||||||
|
try
|
||||||
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
|
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
|
||||||
if path !~# '^\/'
|
catch /^command error (/
|
||||||
let path = s:get_path('', a:name)
|
let path = s:get_path('', a:name)
|
||||||
endif
|
endtry
|
||||||
endif
|
endtry
|
||||||
" We need to extract the section from the path because sometimes
|
" We need to extract the section from the path because sometimes
|
||||||
" the actual section of the manpage is more specific than the section
|
" the actual section of the manpage is more specific than the section
|
||||||
" we provided to `man`. Try ':Man 3 App::CLI'.
|
" we provided to `man`. Try ':Man 3 App::CLI'.
|
||||||
|
|||||||
Reference in New Issue
Block a user