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