blob: 68f68c29604e6b20989ca34a4e3aad5c8b25694e [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Vim help file
Christian Brabandte978b452023-08-13 10:33:05 +02003" Maintainer: The Vim Project <https://github.com/vim/vim>
Christian Brabandt4bfb8992024-10-16 21:58:17 +02004" Last Change: 2024 Oct 16
Christian Brabandte978b452023-08-13 10:33:05 +02005" Former Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
Bram Moolenaard857f0e2005-06-21 22:37:39 +00007" Quit when a (custom) syntax file was already loaded
8if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00009 finish
10endif
11
Bram Moolenaar6ee8d892012-01-10 14:55:01 +010012let s:cpo_save = &cpo
13set cpo&vim
14
Bram Moolenaard13166e2022-11-18 21:49:57 +000015syn match helpHeadline "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
Bram Moolenaar6c35bea2012-07-25 17:49:10 +020016syn match helpSectionDelim "^===.*===$"
17syn match helpSectionDelim "^---.*--$"
Bram Moolenaardd007ed2013-07-09 15:44:17 +020018if has("conceal")
19 syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<" concealends
20else
21 syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<"
22endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000023if has("ebcdic")
Bram Moolenaar18144c82006-04-12 21:52:12 +000024 syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" contains=helpBar
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000025 syn match helpHyperTextEntry "\*[^"*|]\+\*\s"he=e-1 contains=helpStar
26 syn match helpHyperTextEntry "\*[^"*|]\+\*$" contains=helpStar
Bram Moolenaar071d4272004-06-13 20:20:40 +000027else
Bram Moolenaar18144c82006-04-12 21:52:12 +000028 syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" contains=helpBar
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000029 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
30 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" contains=helpStar
Bram Moolenaar071d4272004-06-13 20:20:40 +000031endif
Bram Moolenaar97293012011-07-18 19:40:27 +020032if has("conceal")
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010033 syn match helpBar contained "|" conceal
34 syn match helpBacktick contained "`" conceal
Bram Moolenaar97293012011-07-18 19:40:27 +020035 syn match helpStar contained "\*" conceal
36else
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010037 syn match helpBar contained "|"
38 syn match helpBacktick contained "`"
Bram Moolenaar97293012011-07-18 19:40:27 +020039 syn match helpStar contained "\*"
40endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000041syn match helpNormal "|.*====*|"
Bram Moolenaarf1568ec2011-12-14 21:17:39 +010042syn match helpNormal "|||"
Bram Moolenaar071d4272004-06-13 20:20:40 +000043syn match helpNormal ":|vim:|" " for :help modeline
Bram Moolenaar251835e2014-02-24 02:51:51 +010044syn match helpVim "\<Vim version [0-9][0-9.a-z]*"
Bram Moolenaar071d4272004-06-13 20:20:40 +000045syn match helpVim "VIM REFERENCE.*"
46syn match helpOption "'[a-z]\{2,\}'"
47syn match helpOption "'t_..'"
Bram Moolenaar9fbdbb82022-09-27 17:30:34 +010048syn match helpNormal "'ab'"
Bram Moolenaar7cba6c02013-09-05 22:13:31 +020049syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
Christian Brabandt4bfb8992024-10-16 21:58:17 +020050" doesn't allow a . directly after an ending backtick. See :helpgrep `[^`,]\+ [^`,]\+`\.
51syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|[.?!]\?$\)"hs=s+1,he=e-1 contains=helpBacktick
Bram Moolenaar071d4272004-06-13 20:20:40 +000052syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
Bram Moolenaar166af9b2010-11-16 20:34:40 +010053syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
Bram Moolenaar97293012011-07-18 19:40:27 +020054if has("conceal")
55 syn match helpIgnore "." contained conceal
56else
57 syn match helpIgnore "." contained
58endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000059syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes:
Bram Moolenaar3ec574f2017-06-13 18:12:01 +020060syn keyword helpWarning WARNING WARNING: Warning:
61syn keyword helpDeprecated DEPRECATED DEPRECATED: Deprecated:
Bram Moolenaar071d4272004-06-13 20:20:40 +000062syn match helpSpecial "\<N\>"
63syn match helpSpecial "\<N\.$"me=e-1
64syn match helpSpecial "\<N\.\s"me=e-2
65syn match helpSpecial "(N\>"ms=s+1
Bram Moolenaar01164a62017-11-02 22:58:42 +010066
Bram Moolenaar071d4272004-06-13 20:20:40 +000067syn match helpSpecial "\[N]"
Milly89872f52024-10-05 17:16:18 +020068" avoid highlighting N N in quickref.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +000069syn match helpSpecial "N N"he=s+1
70syn match helpSpecial "Nth"me=e-2
71syn match helpSpecial "N-1"me=e-2
Milly89872f52024-10-05 17:16:18 +020072" highlighting N of cinoptions-values in indent.txt
73syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1
74" highlighting N of cinoptions-values in indent.txt
75syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1
Bram Moolenaar071d4272004-06-13 20:20:40 +000076syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
77syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
78syn match helpSpecial "<[-a-zA-Z0-9_]\+>"
79syn match helpSpecial "<[SCM]-.>"
80syn match helpNormal "<---*>"
81syn match helpSpecial "\[range]"
82syn match helpSpecial "\[line]"
83syn match helpSpecial "\[count]"
84syn match helpSpecial "\[offset]"
85syn match helpSpecial "\[cmd]"
Bram Moolenaar4d8f4762021-06-27 15:18:56 +020086syn match helpNormal "vim9\[cmd]"
Bram Moolenaar071d4272004-06-13 20:20:40 +000087syn match helpSpecial "\[num]"
88syn match helpSpecial "\[+num]"
89syn match helpSpecial "\[-num]"
90syn match helpSpecial "\[+cmd]"
91syn match helpSpecial "\[++opt]"
92syn match helpSpecial "\[arg]"
93syn match helpSpecial "\[arguments]"
94syn match helpSpecial "\[ident]"
95syn match helpSpecial "\[addr]"
96syn match helpSpecial "\[group]"
Bram Moolenaar01164a62017-11-02 22:58:42 +010097" Don't highlight [converted] and others that do not have a tag
98syn match helpNormal "\[\(readonly\|fifo\|socket\|converted\|crypted\)]"
99
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100syn match helpSpecial "CTRL-."
Christian Brabandtd3b55d72024-10-08 20:20:23 +0200101syn match helpSpecial "CTRL-<\a\+>"
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100102syn match helpSpecial "CTRL-SHIFT-."
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103syn match helpSpecial "CTRL-Break"
104syn match helpSpecial "CTRL-PageUp"
105syn match helpSpecial "CTRL-PageDown"
106syn match helpSpecial "CTRL-Insert"
107syn match helpSpecial "CTRL-Del"
108syn match helpSpecial "CTRL-{char}"
109syn region helpNotVi start="{Vi[: ]" start="{not" start="{only" end="}" contains=helpLeadBlank,helpHyperTextJump
110syn match helpLeadBlank "^\s\+" contained
111
112" Highlight group items in their own color.
113syn match helpComment "\t[* ]Comment\t\+[a-z].*"
114syn match helpConstant "\t[* ]Constant\t\+[a-z].*"
115syn match helpString "\t[* ]String\t\+[a-z].*"
116syn match helpCharacter "\t[* ]Character\t\+[a-z].*"
117syn match helpNumber "\t[* ]Number\t\+[a-z].*"
118syn match helpBoolean "\t[* ]Boolean\t\+[a-z].*"
119syn match helpFloat "\t[* ]Float\t\+[a-z].*"
120syn match helpIdentifier "\t[* ]Identifier\t\+[a-z].*"
121syn match helpFunction "\t[* ]Function\t\+[a-z].*"
122syn match helpStatement "\t[* ]Statement\t\+[a-z].*"
123syn match helpConditional "\t[* ]Conditional\t\+[a-z].*"
124syn match helpRepeat "\t[* ]Repeat\t\+[a-z].*"
125syn match helpLabel "\t[* ]Label\t\+[a-z].*"
126syn match helpOperator "\t[* ]Operator\t\+["a-z].*"
127syn match helpKeyword "\t[* ]Keyword\t\+[a-z].*"
128syn match helpException "\t[* ]Exception\t\+[a-z].*"
129syn match helpPreProc "\t[* ]PreProc\t\+[a-z].*"
130syn match helpInclude "\t[* ]Include\t\+[a-z].*"
131syn match helpDefine "\t[* ]Define\t\+[a-z].*"
132syn match helpMacro "\t[* ]Macro\t\+[a-z].*"
133syn match helpPreCondit "\t[* ]PreCondit\t\+[a-z].*"
134syn match helpType "\t[* ]Type\t\+[a-z].*"
135syn match helpStorageClass "\t[* ]StorageClass\t\+[a-z].*"
136syn match helpStructure "\t[* ]Structure\t\+[a-z].*"
137syn match helpTypedef "\t[* ]Typedef\t\+[Aa-z].*"
138syn match helpSpecial "\t[* ]Special\t\+[a-z].*"
139syn match helpSpecialChar "\t[* ]SpecialChar\t\+[a-z].*"
140syn match helpTag "\t[* ]Tag\t\+[a-z].*"
141syn match helpDelimiter "\t[* ]Delimiter\t\+[a-z].*"
142syn match helpSpecialComment "\t[* ]SpecialComment\t\+[a-z].*"
143syn match helpDebug "\t[* ]Debug\t\+[a-z].*"
144syn match helpUnderlined "\t[* ]Underlined\t\+[a-z].*"
145syn match helpError "\t[* ]Error\t\+[a-z].*"
146syn match helpTodo "\t[* ]Todo\t\+[a-z].*"
147
Bram Moolenaar3991dab2006-03-27 17:01:56 +0000148syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-zA-Z0-9/]`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149
Romain Lafourcade124371c2024-01-07 15:08:31 +0100150syn match helpDiffAdded "\t[* ]Added\t\+[a-z].*"
151syn match helpDiffChanged "\t[* ]Changed\t\+[a-z].*"
152syn match helpDiffRemoved "\t[* ]Removed\t\+[a-z].*"
153
Bram Moolenaar071d4272004-06-13 20:20:40 +0000154" Additionally load a language-specific syntax file "help_ab.vim".
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000155let s:i = match(expand("%"), '\.\a\ax$')
156if s:i > 0
157 exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000158endif
159
Bram Moolenaard04b7502010-07-08 22:27:55 +0200160" Italian
Bram Moolenaar7abcaab2010-07-12 23:05:41 +0200161if v:lang =~ '\<IT\>' || v:lang =~ '_IT\>' || v:lang =~? "italian"
162 syn keyword helpNote nota Nota NOTA nota: Nota: NOTA: notare Notare NOTARE notare: Notare: NOTARE:
Bram Moolenaard04b7502010-07-08 22:27:55 +0200163 syn match helpSpecial "Nma"me=e-2
164 syn match helpSpecial "Nme"me=e-2
165 syn match helpSpecial "Nmi"me=e-2
166 syn match helpSpecial "Nmo"me=e-2
167 syn match helpSpecial "\[interv.]"
168 syn region helpNotVi start="{non" start="{solo" start="{disponibile" end="}" contains=helpLeadBlank,helpHyperTextJump
169endif
170
Bram Moolenaar071d4272004-06-13 20:20:40 +0000171syn sync minlines=40
172
173
174" Define the default highlighting.
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000175" Only used when an item doesn't have highlighting yet
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000176hi def link helpIgnore Ignore
Bram Moolenaar36782082013-11-28 13:53:34 +0100177hi def link helpHyperTextJump Identifier
Bram Moolenaar18144c82006-04-12 21:52:12 +0000178hi def link helpBar Ignore
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100179hi def link helpBacktick Ignore
Bram Moolenaar7fc904b2006-04-13 20:37:35 +0000180hi def link helpStar Ignore
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000181hi def link helpHyperTextEntry String
182hi def link helpHeadline Statement
183hi def link helpHeader PreProc
184hi def link helpSectionDelim PreProc
185hi def link helpVim Identifier
Bram Moolenaard38b0552012-04-25 19:07:41 +0200186hi def link helpCommand Comment
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000187hi def link helpExample Comment
188hi def link helpOption Type
189hi def link helpNotVi Special
190hi def link helpSpecial Special
191hi def link helpNote Todo
Bram Moolenaar64d8e252016-09-06 22:12:34 +0200192hi def link helpWarning Todo
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200193hi def link helpDeprecated Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000195hi def link helpComment Comment
196hi def link helpConstant Constant
197hi def link helpString String
198hi def link helpCharacter Character
199hi def link helpNumber Number
200hi def link helpBoolean Boolean
201hi def link helpFloat Float
202hi def link helpIdentifier Identifier
203hi def link helpFunction Function
204hi def link helpStatement Statement
205hi def link helpConditional Conditional
206hi def link helpRepeat Repeat
207hi def link helpLabel Label
208hi def link helpOperator Operator
209hi def link helpKeyword Keyword
210hi def link helpException Exception
211hi def link helpPreProc PreProc
212hi def link helpInclude Include
213hi def link helpDefine Define
214hi def link helpMacro Macro
215hi def link helpPreCondit PreCondit
216hi def link helpType Type
217hi def link helpStorageClass StorageClass
218hi def link helpStructure Structure
219hi def link helpTypedef Typedef
220hi def link helpSpecialChar SpecialChar
221hi def link helpTag Tag
222hi def link helpDelimiter Delimiter
223hi def link helpSpecialComment SpecialComment
224hi def link helpDebug Debug
225hi def link helpUnderlined Underlined
226hi def link helpError Error
227hi def link helpTodo Todo
Bram Moolenaare344bea2005-09-01 20:46:49 +0000228hi def link helpURL String
Romain Lafourcade124371c2024-01-07 15:08:31 +0100229hi def link helpDiffAdded Added
230hi def link helpDiffChanged Changed
231hi def link helpDiffRemoved Removed
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232
Bram Moolenaar2d8ed022022-05-21 13:08:16 +0100233if has('textprop') && expand('%:p') =~ '[/\\]doc[/\\]syntax.txt'
Bram Moolenaard899e512022-05-07 21:54:03 +0100234 " highlight groups with their respective color
235 import 'dist/vimhelp.vim'
236 call vimhelp.HighlightGroups()
237endif
238
Bram Moolenaar071d4272004-06-13 20:20:40 +0000239let b:current_syntax = "help"
240
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100241let &cpo = s:cpo_save
242unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000243" vim: ts=8 sw=2