- let cmd = 'env MANPAGER=cat'.(empty($MANWIDTH) ? ' MANWIDTH='.winwidth(0) : '')
-- let cmd .= ' '.s:man_cmd.' '.shellescape(a:path)
-+ let cmd .= ' '.s:man_cmd.' -l '.shellescape(a:path).'| uniq'
- silent put =system(cmd)
- " remove all the backspaced text
- execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
-@@ -112,7 +112,7 @@
-
- function! s:get_path(sect, name) abort
- if empty(a:sect)
-- let path = system(s:man_cmd.' '.s:man_find_arg.' '.shellescape(a:name))
-+ let path = system(s:man_cmd.' '.s:man_find_arg.' '.shellescape(a:name).'| head -n 1')
- if path !~# '^\/'
- throw 'no manual entry for '.a:name
- endif
-@@ -123,7 +123,7 @@
- " - sections starting with '-'
- " - 3pcap section (found on macOS)
- " - commas between sections (for section priority)
-- return system(s:man_cmd.' '.s:man_find_arg.' -s '.shellescape(a:sect).' '.shellescape(a:name))
-+ return system(s:man_cmd.' '.s:man_find_arg.' -s '.shellescape(a:sect).' '.shellescape(a:name).'| head -n 1')
+- return s:system(['env', 'MANPAGER=cat', (empty($MANWIDTH) ? 'MANWIDTH='.winwidth(0) : ''), 'man', a:path])
++ return s:system(['env', 'MANPAGER=cat', (empty($MANWIDTH) ? 'MANWIDTH='.winwidth(0) : ''), 'mandoc', a:path])