diff options
author | Anmol Sethi <anmol@aubble.com> | 2017-02-01 15:12:52 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-02-04 10:02:59 +0100 |
commit | 3d3b1641d0cae3244c09d4602ab96d290dd0928a (patch) | |
tree | 2ffc29705b607d5debf6d3c53571b454659d4b91 | |
parent | 6d4e08d226971220b02fd74032f931779a0acd38 (diff) | |
download | rneovim-3d3b1641d0cae3244c09d4602ab96d290dd0928a.tar.gz rneovim-3d3b1641d0cae3244c09d4602ab96d290dd0928a.tar.bz2 rneovim-3d3b1641d0cae3244c09d4602ab96d290dd0928a.zip |
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.
-rw-r--r-- | runtime/autoload/man.vim | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index a6be00c0a9..bd3aabf20c 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -55,7 +55,10 @@ function! man#open_page(count, count1, mods, ...) abort try let page = s:get_page(path) catch - close + if a:mods =~# 'tab' || !s:find_man() + " a new window was opened + close + endif call s:error(v:exception) return endtry @@ -175,13 +178,15 @@ function! s:get_path(sect, name) abort endfunction function! s:verify_exists(sect, name) abort - let path = s:get_path(a:sect, a:name) - if path !~# '^\/' - let path = s:get_path(get(b:, 'man_default_sects', ''), a:name) - if path !~# '^\/' + try + let path = s:get_path(a:sect, a:name) + catch /^command error (/ + try + let path = s:get_path(get(b:, 'man_default_sects', ''), a:name) + catch /^command error (/ let path = s:get_path('', a:name) - endif - endif + endtry + endtry " We need to extract the section from the path because sometimes " the actual section of the manpage is more specific than the section " we provided to `man`. Try ':Man 3 App::CLI'. |