blob: 5bdba86212eeacb96faef264a7ad1339d5f7b397 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Man page
Bram Moolenaar5c736222010-01-06 20:54:52 +01003" Maintainer: SungHyun Nam <goweol@gmail.com>
Bram Moolenaar071d4272004-06-13 20:20:40 +00004" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com>
5" Version Info:
Bram Moolenaar2c7f8c52020-04-20 19:52:53 +02006" Last Change: 2020 Apr 15
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
8" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>:
9" * manSubHeading
10" * manSynopsis (only for sections 2 and 3)
11
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020012" quit when a syntax file was already loaded
13if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000014 finish
15endif
16
17" Get the CTRL-H syntax to handle backspaced text
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020018runtime! syntax/ctrlh.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20syn case ignore
Bram Moolenaar2c7f8c52020-04-20 19:52:53 +020021
22syn match manHeader '\%1l.*'
23exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
24
Bram Moolenaar071d4272004-06-13 20:20:40 +000025syn match manReference "\f\+([1-9][a-z]\=)"
Bram Moolenaard042dc82015-11-24 19:18:36 +010026syn match manSectionHeading "^[a-z][a-z -]*[a-z]$"
27syn match manSubHeading "^\s\{3\}[a-z][a-z -]*[a-z]$"
Bram Moolenaar071d4272004-06-13 20:20:40 +000028syn 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
Bram Moolenaar446cb832008-06-24 21:56:24 +000035 syn region manSynopsis start="^SYNOPSIS"hs=s+8 end="^\u\+\s*$"me=e-12 keepend contains=manSectionHeading,@cCode,manCFuncDefinition
Bram Moolenaar071d4272004-06-13 20:20:40 +000036endif
37
38
39" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020040" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000041
Bram Moolenaar2c7f8c52020-04-20 19:52:53 +020042hi def link manHeader Title
43hi def link manFooter PreProc
44
Bram Moolenaarf37506f2016-08-31 22:22:10 +020045hi 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000051
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
53let b:current_syntax = "man"
54
55" vim:ts=8 sts=2 sw=2: