xref: /vim-8.2.3635/runtime/syntax/help.vim (revision a7c4e747)
1" Vim syntax file
2" Language:	Vim help file
3" Maintainer:	Bram Moolenaar ([email protected])
4" Last Change:	2020 Jul 28
5
6" Quit when a (custom) syntax file was already loaded
7if exists("b:current_syntax")
8  finish
9endif
10
11let s:cpo_save = &cpo
12set cpo&vim
13
14syn match helpHeadline		"^[-A-Z .][-A-Z0-9 .()_]*\ze\(\s\+\*\|$\)"
15syn match helpSectionDelim	"^===.*===$"
16syn match helpSectionDelim	"^---.*--$"
17if has("conceal")
18  syn region helpExample	matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<" concealends
19else
20  syn region helpExample	matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<"
21endif
22if has("ebcdic")
23  syn match helpHyperTextJump	"\\\@<!|[^"*|]\+|" contains=helpBar
24  syn match helpHyperTextEntry	"\*[^"*|]\+\*\s"he=e-1 contains=helpStar
25  syn match helpHyperTextEntry	"\*[^"*|]\+\*$" contains=helpStar
26else
27  syn match helpHyperTextJump	"\\\@<!|[#-)!+-~]\+|" contains=helpBar
28  syn match helpHyperTextEntry	"\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
29  syn match helpHyperTextEntry	"\*[#-)!+-~]\+\*$" contains=helpStar
30endif
31if has("conceal")
32  syn match helpBar		contained "|" conceal
33  syn match helpBacktick	contained "`" conceal
34  syn match helpStar		contained "\*" conceal
35else
36  syn match helpBar		contained "|"
37  syn match helpBacktick	contained "`"
38  syn match helpStar		contained "\*"
39endif
40syn match helpNormal		"|.*====*|"
41syn match helpNormal		"|||"
42syn match helpNormal		":|vim:|"	" for :help modeline
43syn match helpVim		"\<Vim version [0-9][0-9.a-z]*"
44syn match helpVim		"VIM REFERENCE.*"
45syn match helpOption		"'[a-z]\{2,\}'"
46syn match helpOption		"'t_..'"
47syn match helpCommand		"`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
48syn match helpCommand		"\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
49syn match helpHeader		"\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
50syn match helpGraphic		".* \ze`$" nextgroup=helpIgnore
51if has("conceal")
52  syn match helpIgnore		"." contained conceal
53else
54  syn match helpIgnore		"." contained
55endif
56syn keyword helpNote		note Note NOTE note: Note: NOTE: Notes Notes:
57syn keyword helpWarning		WARNING WARNING: Warning:
58syn keyword helpDeprecated	DEPRECATED DEPRECATED: Deprecated:
59syn match helpSpecial		"\<N\>"
60syn match helpSpecial		"\<N\.$"me=e-1
61syn match helpSpecial		"\<N\.\s"me=e-2
62syn match helpSpecial		"(N\>"ms=s+1
63
64syn match helpSpecial		"\[N]"
65" avoid highlighting N  N in help.txt
66syn match helpSpecial		"N  N"he=s+1
67syn match helpSpecial		"Nth"me=e-2
68syn match helpSpecial		"N-1"me=e-2
69syn match helpSpecial		"{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
70syn match helpSpecial		"\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
71syn match helpSpecial		"<[-a-zA-Z0-9_]\+>"
72syn match helpSpecial		"<[SCM]-.>"
73syn match helpNormal		"<---*>"
74syn match helpSpecial		"\[range]"
75syn match helpSpecial		"\[line]"
76syn match helpSpecial		"\[count]"
77syn match helpSpecial		"\[offset]"
78syn match helpSpecial		"\[cmd]"
79syn match helpSpecial		"\[num]"
80syn match helpSpecial		"\[+num]"
81syn match helpSpecial		"\[-num]"
82syn match helpSpecial		"\[+cmd]"
83syn match helpSpecial		"\[++opt]"
84syn match helpSpecial		"\[arg]"
85syn match helpSpecial		"\[arguments]"
86syn match helpSpecial		"\[ident]"
87syn match helpSpecial		"\[addr]"
88syn match helpSpecial		"\[group]"
89" Don't highlight [converted] and others that do not have a tag
90syn match helpNormal		"\[\(readonly\|fifo\|socket\|converted\|crypted\)]"
91
92syn match helpSpecial		"CTRL-."
93syn match helpSpecial		"CTRL-SHIFT-."
94syn match helpSpecial		"CTRL-Break"
95syn match helpSpecial		"CTRL-PageUp"
96syn match helpSpecial		"CTRL-PageDown"
97syn match helpSpecial		"CTRL-Insert"
98syn match helpSpecial		"CTRL-Del"
99syn match helpSpecial		"CTRL-{char}"
100syn region helpNotVi		start="{Vi[: ]" start="{not" start="{only" end="}" contains=helpLeadBlank,helpHyperTextJump
101syn match helpLeadBlank		"^\s\+" contained
102
103" Highlight group items in their own color.
104syn match helpComment		"\t[* ]Comment\t\+[a-z].*"
105syn match helpConstant		"\t[* ]Constant\t\+[a-z].*"
106syn match helpString		"\t[* ]String\t\+[a-z].*"
107syn match helpCharacter		"\t[* ]Character\t\+[a-z].*"
108syn match helpNumber		"\t[* ]Number\t\+[a-z].*"
109syn match helpBoolean		"\t[* ]Boolean\t\+[a-z].*"
110syn match helpFloat		"\t[* ]Float\t\+[a-z].*"
111syn match helpIdentifier	"\t[* ]Identifier\t\+[a-z].*"
112syn match helpFunction		"\t[* ]Function\t\+[a-z].*"
113syn match helpStatement		"\t[* ]Statement\t\+[a-z].*"
114syn match helpConditional	"\t[* ]Conditional\t\+[a-z].*"
115syn match helpRepeat		"\t[* ]Repeat\t\+[a-z].*"
116syn match helpLabel		"\t[* ]Label\t\+[a-z].*"
117syn match helpOperator		"\t[* ]Operator\t\+["a-z].*"
118syn match helpKeyword		"\t[* ]Keyword\t\+[a-z].*"
119syn match helpException		"\t[* ]Exception\t\+[a-z].*"
120syn match helpPreProc		"\t[* ]PreProc\t\+[a-z].*"
121syn match helpInclude		"\t[* ]Include\t\+[a-z].*"
122syn match helpDefine		"\t[* ]Define\t\+[a-z].*"
123syn match helpMacro		"\t[* ]Macro\t\+[a-z].*"
124syn match helpPreCondit		"\t[* ]PreCondit\t\+[a-z].*"
125syn match helpType		"\t[* ]Type\t\+[a-z].*"
126syn match helpStorageClass	"\t[* ]StorageClass\t\+[a-z].*"
127syn match helpStructure		"\t[* ]Structure\t\+[a-z].*"
128syn match helpTypedef		"\t[* ]Typedef\t\+[Aa-z].*"
129syn match helpSpecial		"\t[* ]Special\t\+[a-z].*"
130syn match helpSpecialChar	"\t[* ]SpecialChar\t\+[a-z].*"
131syn match helpTag		"\t[* ]Tag\t\+[a-z].*"
132syn match helpDelimiter		"\t[* ]Delimiter\t\+[a-z].*"
133syn match helpSpecialComment	"\t[* ]SpecialComment\t\+[a-z].*"
134syn match helpDebug		"\t[* ]Debug\t\+[a-z].*"
135syn match helpUnderlined	"\t[* ]Underlined\t\+[a-z].*"
136syn match helpError		"\t[* ]Error\t\+[a-z].*"
137syn match helpTodo		"\t[* ]Todo\t\+[a-z].*"
138
139syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' 	<>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' 	<>"]+)[a-zA-Z0-9/]`
140
141" Additionally load a language-specific syntax file "help_ab.vim".
142let s:i = match(expand("%"), '\.\a\ax$')
143if s:i > 0
144  exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
145endif
146
147" Italian
148if v:lang =~ '\<IT\>' || v:lang =~ '_IT\>' || v:lang =~? "italian"
149  syn keyword helpNote		nota Nota NOTA nota: Nota: NOTA: notare Notare NOTARE notare: Notare: NOTARE:
150  syn match helpSpecial		"Nma"me=e-2
151  syn match helpSpecial		"Nme"me=e-2
152  syn match helpSpecial		"Nmi"me=e-2
153  syn match helpSpecial		"Nmo"me=e-2
154  syn match helpSpecial		"\[interv.]"
155  syn region helpNotVi		start="{non" start="{solo" start="{disponibile" end="}" contains=helpLeadBlank,helpHyperTextJump
156endif
157
158syn sync minlines=40
159
160
161" Define the default highlighting.
162" Only used when an item doesn't have highlighting yet
163hi def link helpIgnore		Ignore
164hi def link helpHyperTextJump	Identifier
165hi def link helpBar		Ignore
166hi def link helpBacktick	Ignore
167hi def link helpStar		Ignore
168hi def link helpHyperTextEntry	String
169hi def link helpHeadline	Statement
170hi def link helpHeader		PreProc
171hi def link helpSectionDelim	PreProc
172hi def link helpVim		Identifier
173hi def link helpCommand		Comment
174hi def link helpExample		Comment
175hi def link helpOption		Type
176hi def link helpNotVi		Special
177hi def link helpSpecial		Special
178hi def link helpNote		Todo
179hi def link helpWarning		Todo
180hi def link helpDeprecated	Todo
181
182hi def link helpComment		Comment
183hi def link helpConstant	Constant
184hi def link helpString		String
185hi def link helpCharacter	Character
186hi def link helpNumber		Number
187hi def link helpBoolean		Boolean
188hi def link helpFloat		Float
189hi def link helpIdentifier	Identifier
190hi def link helpFunction	Function
191hi def link helpStatement	Statement
192hi def link helpConditional	Conditional
193hi def link helpRepeat		Repeat
194hi def link helpLabel		Label
195hi def link helpOperator	Operator
196hi def link helpKeyword		Keyword
197hi def link helpException	Exception
198hi def link helpPreProc		PreProc
199hi def link helpInclude		Include
200hi def link helpDefine		Define
201hi def link helpMacro		Macro
202hi def link helpPreCondit	PreCondit
203hi def link helpType		Type
204hi def link helpStorageClass	StorageClass
205hi def link helpStructure	Structure
206hi def link helpTypedef		Typedef
207hi def link helpSpecialChar	SpecialChar
208hi def link helpTag		Tag
209hi def link helpDelimiter	Delimiter
210hi def link helpSpecialComment	SpecialComment
211hi def link helpDebug		Debug
212hi def link helpUnderlined	Underlined
213hi def link helpError		Error
214hi def link helpTodo		Todo
215hi def link helpURL		String
216
217let b:current_syntax = "help"
218
219let &cpo = s:cpo_save
220unlet s:cpo_save
221" vim: ts=8 sw=2
222