robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:62d8f3d: runtime: Revert several "mark invalid contact addresses" commits (#37192)ab20681c52

master
7.4 KiB237 linesraw
1" VIM syntax file
2" Language:	nroff/groff
3" Maintainer:	John Marshall <jmarshall@hey.com>
4" Previous Maintainer:	Pedro Alejandro López-Valencia <palopezv@gmail.com>
5" Previous Maintainer:	Jérôme Plût <Jerome.Plut@ens.fr>
6" Last Change:	2021 Mar 28
7"	2025 Apr 24 by Eisuke Kawashima (move options from syntax to ftplugin #17174)
8"
9" {{{1 Todo
10"
11" TODO:
12"
13" * Write syntax highlighting files for the preprocessors,
14"	and integrate with nroff.vim.
15"
16"
17" {{{1 Start syntax highlighting.
18"
19" quit when a syntax file was already loaded
20"
21if exists("b:current_syntax")
22	finish
23endif
24
25let s:cpo_save = &cpo
26set cpo&vim
27
28if exists("nroff_is_groff")
29	let b:nroff_is_groff = 1
30endif
31
32syn spell toplevel
33syn case match
34
35"
36" {{{1 plugin settings...
37"
38" {{{2 enable spacing error highlighting
39"
40if exists("nroff_space_errors")
41	syn match nroffError /\s\+$/
42	syn match nroffSpaceError /[.,:;!?]\s\{2,}/
43endif
44
45" {{{1 Escape sequences
46" ------------------------------------------------------------
47
48syn match nroffEscChar /\\[CN]/ nextgroup=nroffEscCharArg
49syn match nroffEscape /\\[*fgmnYV]/ nextgroup=nroffEscRegPar,nroffEscRegArg
50syn match nroffEscape /\\s[+-]\=/ nextgroup=nroffSize
51syn match nroffEscape /\\[$AbDhlLRvxXZ]/ nextgroup=nroffEscPar,nroffEscArg
52
53syn match nroffEscRegArg /./ contained
54syn match nroffEscRegArg2 /../ contained
55syn match nroffEscRegPar /(/ contained nextgroup=nroffEscRegArg2
56syn match nroffEscArg /./ contained
57syn match nroffEscArg2 /../ contained
58syn match nroffEscPar /(/ contained nextgroup=nroffEscArg2
59syn match nroffSize /\((\d\)\=\d/ contained
60
61syn region nroffEscCharArg start=/'/ end=/'/ contained
62syn region nroffEscArg start=/'/ end=/'/ contained contains=nroffEscape,@nroffSpecial
63
64if exists("b:nroff_is_groff")
65	syn region nroffEscRegArg matchgroup=nroffEscape start=/\[/ end=/\]/ contained oneline
66	syn region nroffSize matchgroup=nroffEscape start=/\[/ end=/\]/ contained
67endif
68
69syn match nroffEscape /\\[adprtu{}]/
70syn match nroffEscape /\\$/
71syn match nroffEscape /\\\$[@*]/
72
73" {{{1 Strings and special characters
74" ------------------------------------------------------------
75
76syn match nroffSpecialChar /\\[\\eE?!-]/
77syn match nroffSpace "\\[&%~|^0)/,]"
78syn match nroffSpecialChar /\\(../
79
80if exists("b:nroff_is_groff")
81	syn match nroffSpecialChar /\\\[[^]]*]/
82	syn region nroffPreserve  matchgroup=nroffSpecialChar start=/\\?/ end=/\\?/ oneline
83endif
84
85syn region nroffPreserve matchgroup=nroffSpecialChar start=/\\!/ end=/$/ oneline
86
87syn cluster nroffSpecial contains=nroffSpecialChar,nroffSpace
88
89
90syn region nroffString start=/"/ end=/"/ skip=/\\$/ contains=nroffEscape,@nroffSpecial contained
91syn region nroffString start=/'/ end=/'/ skip=/\\$/ contains=nroffEscape,@nroffSpecial contained
92
93
94" {{{1 Numbers and units
95" ------------------------------------------------------------
96syn match nroffNumBlock /[0-9.]\a\=/ contained contains=nroffNumber
97syn match nroffNumber /\d\+\(\.\d*\)\=/ contained nextgroup=nroffUnit,nroffBadChar
98syn match nroffNumber /\.\d\+)/ contained nextgroup=nroffUnit,nroffBadChar
99syn match nroffBadChar /./ contained
100syn match nroffUnit /[icpPszmnvMu]/ contained
101
102
103" {{{1 Requests
104" ------------------------------------------------------------
105
106" Requests begin with . or ' at the beginning of a line, or
107" after .if or .ie.
108
109syn match nroffReqLeader /^[.']/	nextgroup=nroffReqName skipwhite
110syn match nroffReqLeader /[.']/	contained nextgroup=nroffReqName skipwhite
111
112if exists("b:nroff_is_groff")
113"
114" GNU troff allows long request names
115"
116	syn match nroffReqName /[^\t \\\[?]\+/ contained nextgroup=nroffReqArg
117else
118	syn match nroffReqName /[^\t \\\[?]\{1,2}/ contained nextgroup=nroffReqArg
119endif
120
121syn region nroffReqArg start=/\S/ skip=/\\$/ end=/$/ contained contains=nroffEscape,@nroffSpecial,nroffString,nroffError,nroffSpaceError,nroffNumBlock,nroffComment
122
123" {{{2 Conditional: .if .ie .el
124syn match nroffReqName /\(if\|ie\)/ contained nextgroup=nroffCond skipwhite
125syn match nroffReqName /el/ contained nextgroup=nroffReqLeader skipwhite
126syn match nroffCond /\S\+/ contained nextgroup=nroffReqLeader skipwhite
127
128" {{{2 String definition: .ds .as
129syn match nroffReqname /[da]s/ contained nextgroup=nroffDefIdent skipwhite
130syn match nroffDefIdent /\S\+/ contained nextgroup=nroffDefinition skipwhite
131syn region nroffDefinition matchgroup=nroffSpecialChar start=/"/ matchgroup=NONE end=/\\"/me=e-2 skip=/\\$/ start=/\S/ end=/$/ contained contains=nroffDefSpecial
132syn match nroffDefSpecial /\\$/ contained
133syn match nroffDefSpecial /\\\((.\)\=./ contained
134
135if exists("b:nroff_is_groff")
136	syn match nroffDefSpecial /\\\[[^]]*]/ contained
137endif
138
139" {{{2 Macro definition: .de .am, also diversion: .di
140syn match nroffReqName /\(d[ei]\|am\)/ contained nextgroup=nroffIdent skipwhite
141syn match nroffIdent /[^[?( \t]\+/ contained
142if exists("b:nroff_is_groff")
143	syn match nroffReqName /als/ contained nextgroup=nroffIdent skipwhite
144endif
145
146" {{{2 Register definition: .rn .rr
147syn match nroffReqName /[rn]r/ contained nextgroup=nroffIdent skipwhite
148if exists("b:nroff_is_groff")
149	syn match nroffReqName /\(rnn\|aln\)/ contained nextgroup=nroffIdent skipwhite
150endif
151
152
153" {{{1 eqn/tbl/pic
154" ------------------------------------------------------------
155" <jp>
156" XXX: write proper syntax highlight for eqn / tbl / pic ?
157" <jp />
158
159syn region nroffEquation start=/^\.\s*EQ\>/ end=/^\.\s*EN\>/
160syn region nroffTable start=/^\.\s*TS\>/ end=/^\.\s*TE\>/ contains=@Spell
161syn region nroffPicture start=/^\.\s*PS\>/ end=/^\.\s*PE\>/
162syn region nroffRefer start=/^\.\s*\[\>/ end=/^\.\s*\]\>/ contains=@Spell
163syn region nroffGrap start=/^\.\s*G1\>/ end=/^\.\s*G2\>/
164syn region nroffGremlin start=/^\.\s*GS\>/ end=/^\.\s*GE|GF\>/
165
166" {{{1 Comments
167" ------------------------------------------------------------
168
169syn region nroffIgnore start=/^[.']\s*ig/ end=/^['.]\s*\./
170syn match nroffComment /\(^[.']\s*\)\=\\".*/ contains=nroffTodo,@Spell
171syn match nroffComment /^'''.*/  contains=nroffTodo,@Spell
172
173if exists("b:nroff_is_groff")
174	syn match nroffComment "\\#.*$" contains=nroffTodo,@Spell
175endif
176
177syn keyword nroffTodo TODO XXX FIXME contained
178
179" {{{1 Hilighting
180" ------------------------------------------------------------
181"
182
183"
184" Define the default highlighting.
185" Only when an item doesn't have highlighting yet
186"
187
188hi def link nroffEscChar nroffSpecialChar
189hi def link nroffEscCharArg nroffSpecialChar
190hi def link nroffSpecialChar SpecialChar
191hi def link nroffSpace Delimiter
192
193hi def link nroffEscRegArg2 nroffEscRegArg
194hi def link nroffEscRegArg nroffIdent
195
196hi def link nroffEscArg2 nroffEscArg
197hi def link nroffEscPar nroffEscape
198
199hi def link nroffEscRegPar nroffEscape
200hi def link nroffEscArg nroffEscape
201hi def link nroffSize nroffEscape
202hi def link nroffEscape PreProc
203
204hi def link nroffIgnore Comment
205hi def link nroffComment Comment
206hi def link nroffTodo Todo
207
208hi def link nroffReqLeader nroffRequest
209hi def link nroffReqName nroffRequest
210hi def link nroffRequest Statement
211hi def link nroffCond PreCondit
212hi def link nroffDefIdent nroffIdent
213hi def link nroffIdent Identifier
214
215hi def link nroffEquation PreProc
216hi def link nroffTable PreProc
217hi def link nroffPicture PreProc
218hi def link nroffRefer PreProc
219hi def link nroffGrap PreProc
220hi def link nroffGremlin PreProc
221
222hi def link nroffNumber Number
223hi def link nroffBadChar nroffError
224hi def link nroffSpaceError nroffError
225hi def link nroffError Error
226
227hi def link nroffPreserve String
228hi def link nroffString String
229hi def link nroffDefinition String
230hi def link nroffDefSpecial Special
231
232
233let b:current_syntax = "nroff"
234
235let &cpo = s:cpo_save
236unlet s:cpo_save
237" vim600: set fdm=marker fdl=2: