aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/man.vim6
-rw-r--r--runtime/syntax/man.vim15
2 files changed, 16 insertions, 5 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index f21e2ee4f3..77ccbdf888 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -212,9 +212,9 @@ function! man#extract_sect_and_name_ref(ref) abort
endfunction
function! s:get_path(sect, name) abort
+ " Some man implementations (OpenBSD) return all available paths from the
+ " search command, so we get() the first one. #8341
if empty(a:sect)
- " Some man implementations (OpenBSD) return all available paths from the
- " search command, so we get() the first one. #8341
return substitute(get(split(s:system(['man', s:find_arg, a:name])), 0, ''), '\n\+$', '', '')
endif
" '-s' flag handles:
@@ -222,7 +222,7 @@ function! s:get_path(sect, name) abort
" - sections starting with '-'
" - 3pcap section (found on macOS)
" - commas between sections (for section priority)
- return substitute(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name]), '\n\+$', '', '')
+ return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '')
endfunction
function! s:verify_exists(sect, name) abort
diff --git a/runtime/syntax/man.vim b/runtime/syntax/man.vim
index b8e605cb9a..9ae50d17a5 100644
--- a/runtime/syntax/man.vim
+++ b/runtime/syntax/man.vim
@@ -30,17 +30,28 @@ endif
if !exists('b:man_sect')
call man#init_pager()
endif
-if b:man_sect =~# '^[23]'
+if b:man_sect =~# '^[023]'
+ syntax case match
syntax include @c $VIMRUNTIME/syntax/c.vim
syntax match manCFuncDefinition display '\<\h\w*\>\ze\(\s\|\n\)*(' contained
+ syntax match manSentence display '\%(^ \{3,7}\u\|\. \u\)\_.\{-}
+ \\%(-$\|\.$\|:$\)\|
+ \ \{3,7}\a.*\%(\.\|:\)$' contained contains=manReference
syntax region manSynopsis start='^\%(
\SYNOPSIS\|
\SYNTAX\|
\SINTASSI\|
\SKŁADNIA\|
\СИНТАКСИС\|
- \書式\)$' end='^\%(\S.*\)\=\S$' keepend contains=manSectionHeading,@c,manCFuncDefinition
+ \書式\)$' end='^\%(\S.*\)\=\S$' keepend contains=manSentence,manSectionHeading,@c,manCFuncDefinition
highlight default link manCFuncDefinition Function
+
+ syntax region manExample start='^EXAMPLES\=$' end='^\%(\S.*\)\=\S$' keepend contains=manSentence,manSectionHeading,manSubHeading,@c,manCFuncDefinition
+
+ " XXX: groupthere doesn't seem to work
+ syntax sync minlines=500
+ "syntax sync match manSyncExample groupthere manExample '^EXAMPLES\=$'
+ "syntax sync match manSyncExample groupthere NONE '^\%(EXAMPLES\=\)\@!\%(\S.*\)\=\S$'
endif
" Prevent everything else from matching the last line