man.vim (1802B)
1 " Vim syntax file 2 " Language: Man page 3 " Maintainer: Jason Franklin <vim@justemail.net> 4 " Previous Maintainer: SungHyun Nam <goweol@gmail.com> 5 " Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com> 6 " Version Info: 7 " Last Change: 2020 Sep 19 8 9 " Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>: 10 " * manSubHeading 11 " * manSynopsis (only for sections 2 and 3) 12 13 " quit when a syntax file was already loaded 14 if exists("b:current_syntax") 15 finish 16 endif 17 18 " Get the CTRL-H syntax to handle backspaced text 19 runtime! syntax/ctrlh.vim 20 21 syn case ignore 22 23 " See notes about hyphenation in s:ParseIntoPageAndSection of 24 " autoload/dist/man.vim. 25 syn match manReference "\%(\f\+[\u2010-]\%(\n\|\r\n\=\)\s\+\)\=\f\+([1-9]\l*)" 26 syn match manSectionHeading "^\a.*$" 27 syn match manSubHeading "^\s\{3\}\a.*$" 28 syn match manOptionDesc "^\s*[+-][a-z0-9]\S*" 29 syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*" 30 " syn match manHistory "^[a-z].*last change.*$" 31 32 syn match manHeader '\%1l.*' 33 exe 'syn match manFooter ''\%' . line('$') . 'l.*''' 34 35 if getline(1) =~ '^[a-zA-Z_]\+([23])' 36 syntax include @cCode <sfile>:p:h/c.vim 37 syn match manCFuncDefinition display "\<\h\w*\>\s*("me=e-1 contained 38 syn region manSynopsis start="^SYNOPSIS"hs=s+8 end="^\u\+\s*$"me=e-12 keepend contains=manSectionHeading,@cCode,manCFuncDefinition 39 endif 40 41 42 " Define the default highlighting. 43 " Only when an item doesn't have highlighting yet 44 45 hi def link manHeader Title 46 hi def link manFooter PreProc 47 48 hi def link manSectionHeading Statement 49 hi def link manOptionDesc Constant 50 hi def link manLongOptionDesc Constant 51 hi def link manReference PreProc 52 hi def link manSubHeading Function 53 hi def link manCFuncDefinition Function 54 55 56 let b:current_syntax = "man" 57 58 " vim:ts=8 sts=2 sw=2: