blob: dfbb35a7002dfc93a21a210b4f5faa78777545f7 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Man page
Bram Moolenaar7ceefb32020-05-01 16:07:38 +02003" Maintainer: Jason Franklin <vim@justemail.net>
4" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
Bram Moolenaar071d4272004-06-13 20:20:40 +00005" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com>
6" Version Info:
Bram Moolenaard58a3bf2020-09-28 21:48:16 +02007" Last Change: 2020 Sep 19
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>:
10" * manSubHeading
11" * manSynopsis (only for sections 2 and 3)
12
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020013" quit when a syntax file was already loaded
14if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000015 finish
16endif
17
18" Get the CTRL-H syntax to handle backspaced text
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020019runtime! syntax/ctrlh.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
21syn case ignore
Bram Moolenaar2c7f8c52020-04-20 19:52:53 +020022
goweol8cfe52e2023-08-18 06:13:29 +090023" See notes about hyphenation in s:ParseIntoPageAndSection of
24" autoload/dist/man.vim.
25syn match manReference "\%(\f\+[\u2010-]\%(\n\|\r\n\=\)\s\+\)\=\f\+([1-9]\l*)"
Bram Moolenaard58a3bf2020-09-28 21:48:16 +020026syn match manSectionHeading "^\a.*$"
27syn match manSubHeading "^\s\{3\}\a.*$"
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
Bram Moolenaar7ceefb32020-05-01 16:07:38 +020032syn match manHeader '\%1l.*'
33exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
34
Bram Moolenaar071d4272004-06-13 20:20:40 +000035if 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
Bram Moolenaar446cb832008-06-24 21:56:24 +000038 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 +000039endif
40
41
42" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020043" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000044
Bram Moolenaar2c7f8c52020-04-20 19:52:53 +020045hi def link manHeader Title
46hi def link manFooter PreProc
47
Bram Moolenaarf37506f2016-08-31 22:22:10 +020048hi def link manSectionHeading Statement
49hi def link manOptionDesc Constant
50hi def link manLongOptionDesc Constant
51hi def link manReference PreProc
52hi def link manSubHeading Function
53hi def link manCFuncDefinition Function
Bram Moolenaar071d4272004-06-13 20:20:40 +000054
Bram Moolenaar071d4272004-06-13 20:20:40 +000055
56let b:current_syntax = "man"
57
58" vim:ts=8 sts=2 sw=2: