aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraichoo <raichoo@googlemail.com>2017-05-25 21:49:53 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-05-26 00:30:40 +0200
commit967e892cb68cd6d49c063fff1f8dbce22e2bc20b (patch)
tree068650ab04ac11bf055fd39d1f329a51ae2c5c31
parent7a1a3a125843c5076436b6b790209730913e523d (diff)
downloadrneovim-967e892cb68cd6d49c063fff1f8dbce22e2bc20b.tar.gz
rneovim-967e892cb68cd6d49c063fff1f8dbce22e2bc20b.tar.bz2
rneovim-967e892cb68cd6d49c063fff1f8dbce22e2bc20b.zip
man.vim: feature-test section (-s) flag #6815
Different implementations of `man` might be using different flags for sections.
-rw-r--r--runtime/autoload/man.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index 361ade59d3..dd71ede680 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -2,8 +2,17 @@
let s:find_arg = '-w'
let s:localfile_arg = v:true " Always use -l if possible. #6683
+let s:section_arg = '-s'
+
+function! s:init_section_flag()
+ call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man'])
+ if v:shell_error
+ let s:section_arg = '-S'
+ endif
+endfunction
function! s:init() abort
+ call s:init_section_flag()
" TODO(nhooyr): Does `man -l` on SunOS list searched directories?
try
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
@@ -211,7 +220,7 @@ function! s:get_path(sect, name) abort
" - sections starting with '-'
" - 3pcap section (found on macOS)
" - commas between sections (for section priority)
- return s:system(['man', s:find_arg, '-s', a:sect, a:name])
+ return s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])
endfunction
function! s:verify_exists(sect, name) abort