From ad2dbd4b5f2cfa740e373fff0e021e2163909cfb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 18 Jan 2022 02:45:46 +0800 Subject: [PATCH] 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. --- runtime/autoload/man.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index a954e1b1a3..b28170b7a1 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -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 " 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) return ''