fix(man.vim): support calling :Man without a section again (#17119)

When `man -w` is called with an empty string as section name, it may
fail with an error code, which causes :Man to no longer work without a
section. Just remove that argument when no section is specified.
This commit is contained in:
zeertzjq 2022-01-18 02:45:46 +08:00 committed by GitHub
parent 70db972e5f
commit ad2dbd4b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,7 +232,11 @@ function! s:get_path(sect, name) abort
" "
" Finally, we can avoid relying on -S or -s here since they are very " Finally, we can avoid relying on -S or -s here since they are very
" inconsistently supported. Instead, call -w with a section and a name. " inconsistently supported. Instead, call -w with a section and a name.
let results = split(s:system(['man', s:find_arg, a:sect, a:name])) if empty(a:sect)
let results = split(s:system(['man', s:find_arg, a:name]))
else
let results = split(s:system(['man', s:find_arg, a:sect, a:name]))
endif
if empty(results) if empty(results)
return '' return ''