blob: 3886164b334a62490787cb1ef02f1193273e9c7f [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>
Shougo Matsushita6fea0a52024-12-15 20:47:37 +01004" Last Change: 2024 Dec 15
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 "^---.*--$"
Shougo Matsushita6fea0a52024-12-15 20:47:37 +010018
19unlet! b:current_syntax
20" sil! to prevent E403
21silent! syntax include @VimScript syntax/vim.vim
Bram Moolenaardd007ed2013-07-09 15:44:17 +020022if has("conceal")
23 syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<" concealends
Shougo Matsushita6fea0a52024-12-15 20:47:37 +010024 syn region helpExampleVimScript matchgroup=helpIgnore
25 \ start=/^>vim$/ start=/ >vim$/
26 \ end=/^[^ \t]/me=e-1 end=/^</ concealends
27 \ contains=@VimScript keepend
28 else
29 syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<"
30 syn region helpExampleVimScript matchgroup=helpIgnore
31 \ start=/^>vim$/ start=/ >vim$/
32 \ end=/^[^ \t]/me=e-1 end=/^</
33 \ contains=@VimScript keepend
Bram Moolenaardd007ed2013-07-09 15:44:17 +020034endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000035if has("ebcdic")
Bram Moolenaar18144c82006-04-12 21:52:12 +000036 syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" contains=helpBar
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000037 syn match helpHyperTextEntry "\*[^"*|]\+\*\s"he=e-1 contains=helpStar
38 syn match helpHyperTextEntry "\*[^"*|]\+\*$" contains=helpStar
Bram Moolenaar071d4272004-06-13 20:20:40 +000039else
Bram Moolenaar18144c82006-04-12 21:52:12 +000040 syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" contains=helpBar
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000041 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
42 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" contains=helpStar
Bram Moolenaar071d4272004-06-13 20:20:40 +000043endif
Bram Moolenaar97293012011-07-18 19:40:27 +020044if has("conceal")
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010045 syn match helpBar contained "|" conceal
46 syn match helpBacktick contained "`" conceal
Bram Moolenaar97293012011-07-18 19:40:27 +020047 syn match helpStar contained "\*" conceal
48else
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010049 syn match helpBar contained "|"
50 syn match helpBacktick contained "`"
Bram Moolenaar97293012011-07-18 19:40:27 +020051 syn match helpStar contained "\*"
52endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000053syn match helpNormal "|.*====*|"
Bram Moolenaarf1568ec2011-12-14 21:17:39 +010054syn match helpNormal "|||"
Bram Moolenaar071d4272004-06-13 20:20:40 +000055syn match helpNormal ":|vim:|" " for :help modeline
Bram Moolenaar251835e2014-02-24 02:51:51 +010056syn match helpVim "\<Vim version [0-9][0-9.a-z]*"
Bram Moolenaar071d4272004-06-13 20:20:40 +000057syn match helpVim "VIM REFERENCE.*"
58syn match helpOption "'[a-z]\{2,\}'"
59syn match helpOption "'t_..'"
Bram Moolenaar9fbdbb82022-09-27 17:30:34 +010060syn match helpNormal "'ab'"
Bram Moolenaar7cba6c02013-09-05 22:13:31 +020061syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
Christian Brabandt4bfb8992024-10-16 21:58:17 +020062" doesn't allow a . directly after an ending backtick. See :helpgrep `[^`,]\+ [^`,]\+`\.
63syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|[.?!]\?$\)"hs=s+1,he=e-1 contains=helpBacktick
Bram Moolenaar071d4272004-06-13 20:20:40 +000064syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
Bram Moolenaar166af9b2010-11-16 20:34:40 +010065syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
Bram Moolenaar97293012011-07-18 19:40:27 +020066if has("conceal")
67 syn match helpIgnore "." contained conceal
68else
69 syn match helpIgnore "." contained
70endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000071syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes:
Milly6c2fc372024-10-16 22:11:17 +020072syn match helpNote "\c(note\(:\|\>\)"ms=s+1
Bram Moolenaar3ec574f2017-06-13 18:12:01 +020073syn keyword helpWarning WARNING WARNING: Warning:
74syn keyword helpDeprecated DEPRECATED DEPRECATED: Deprecated:
Bram Moolenaar071d4272004-06-13 20:20:40 +000075syn match helpSpecial "\<N\>"
76syn match helpSpecial "\<N\.$"me=e-1
77syn match helpSpecial "\<N\.\s"me=e-2
78syn match helpSpecial "(N\>"ms=s+1
Bram Moolenaar01164a62017-11-02 22:58:42 +010079
Bram Moolenaar071d4272004-06-13 20:20:40 +000080syn match helpSpecial "\[N]"
Milly89872f52024-10-05 17:16:18 +020081" avoid highlighting N N in quickref.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +000082syn match helpSpecial "N N"he=s+1
83syn match helpSpecial "Nth"me=e-2
84syn match helpSpecial "N-1"me=e-2
Milly6c2fc372024-10-16 22:11:17 +020085" highlighting N for :resize in windows.txt
86syn match helpSpecial "] -N\>"ms=s+3
87syn match helpSpecial "+N\>"ms=s+1
88syn match helpSpecial "\[+-]N\>"ms=s+4
Milly89872f52024-10-05 17:16:18 +020089" highlighting N of cinoptions-values in indent.txt
90syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1
91" highlighting N of cinoptions-values in indent.txt
92syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1
Bram Moolenaar071d4272004-06-13 20:20:40 +000093syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
94syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
95syn match helpSpecial "<[-a-zA-Z0-9_]\+>"
96syn match helpSpecial "<[SCM]-.>"
97syn match helpNormal "<---*>"
98syn match helpSpecial "\[range]"
99syn match helpSpecial "\[line]"
100syn match helpSpecial "\[count]"
101syn match helpSpecial "\[offset]"
102syn match helpSpecial "\[cmd]"
Bram Moolenaar4d8f4762021-06-27 15:18:56 +0200103syn match helpNormal "vim9\[cmd]"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104syn match helpSpecial "\[num]"
105syn match helpSpecial "\[+num]"
106syn match helpSpecial "\[-num]"
107syn match helpSpecial "\[+cmd]"
108syn match helpSpecial "\[++opt]"
109syn match helpSpecial "\[arg]"
110syn match helpSpecial "\[arguments]"
111syn match helpSpecial "\[ident]"
112syn match helpSpecial "\[addr]"
113syn match helpSpecial "\[group]"
Bram Moolenaar01164a62017-11-02 22:58:42 +0100114" Don't highlight [converted] and others that do not have a tag
115syn match helpNormal "\[\(readonly\|fifo\|socket\|converted\|crypted\)]"
116
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117syn match helpSpecial "CTRL-."
Christian Brabandtd3b55d72024-10-08 20:20:23 +0200118syn match helpSpecial "CTRL-<\a\+>"
Bram Moolenaar0c0734d2019-11-26 21:44:46 +0100119syn match helpSpecial "CTRL-SHIFT-."
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120syn match helpSpecial "CTRL-Break"
121syn match helpSpecial "CTRL-PageUp"
122syn match helpSpecial "CTRL-PageDown"
123syn match helpSpecial "CTRL-Insert"
124syn match helpSpecial "CTRL-Del"
125syn match helpSpecial "CTRL-{char}"
126syn region helpNotVi start="{Vi[: ]" start="{not" start="{only" end="}" contains=helpLeadBlank,helpHyperTextJump
127syn match helpLeadBlank "^\s\+" contained
128
129" Highlight group items in their own color.
130syn match helpComment "\t[* ]Comment\t\+[a-z].*"
131syn match helpConstant "\t[* ]Constant\t\+[a-z].*"
132syn match helpString "\t[* ]String\t\+[a-z].*"
133syn match helpCharacter "\t[* ]Character\t\+[a-z].*"
134syn match helpNumber "\t[* ]Number\t\+[a-z].*"
135syn match helpBoolean "\t[* ]Boolean\t\+[a-z].*"
136syn match helpFloat "\t[* ]Float\t\+[a-z].*"
137syn match helpIdentifier "\t[* ]Identifier\t\+[a-z].*"
138syn match helpFunction "\t[* ]Function\t\+[a-z].*"
139syn match helpStatement "\t[* ]Statement\t\+[a-z].*"
140syn match helpConditional "\t[* ]Conditional\t\+[a-z].*"
141syn match helpRepeat "\t[* ]Repeat\t\+[a-z].*"
142syn match helpLabel "\t[* ]Label\t\+[a-z].*"
143syn match helpOperator "\t[* ]Operator\t\+["a-z].*"
144syn match helpKeyword "\t[* ]Keyword\t\+[a-z].*"
145syn match helpException "\t[* ]Exception\t\+[a-z].*"
146syn match helpPreProc "\t[* ]PreProc\t\+[a-z].*"
147syn match helpInclude "\t[* ]Include\t\+[a-z].*"
148syn match helpDefine "\t[* ]Define\t\+[a-z].*"
149syn match helpMacro "\t[* ]Macro\t\+[a-z].*"
150syn match helpPreCondit "\t[* ]PreCondit\t\+[a-z].*"
151syn match helpType "\t[* ]Type\t\+[a-z].*"
152syn match helpStorageClass "\t[* ]StorageClass\t\+[a-z].*"
153syn match helpStructure "\t[* ]Structure\t\+[a-z].*"
154syn match helpTypedef "\t[* ]Typedef\t\+[Aa-z].*"
155syn match helpSpecial "\t[* ]Special\t\+[a-z].*"
156syn match helpSpecialChar "\t[* ]SpecialChar\t\+[a-z].*"
157syn match helpTag "\t[* ]Tag\t\+[a-z].*"
158syn match helpDelimiter "\t[* ]Delimiter\t\+[a-z].*"
159syn match helpSpecialComment "\t[* ]SpecialComment\t\+[a-z].*"
160syn match helpDebug "\t[* ]Debug\t\+[a-z].*"
161syn match helpUnderlined "\t[* ]Underlined\t\+[a-z].*"
162syn match helpError "\t[* ]Error\t\+[a-z].*"
163syn match helpTodo "\t[* ]Todo\t\+[a-z].*"
164
Milly6c2fc372024-10-16 22:11:17 +0200165syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'" \t<>{}]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'" \t<>{}]+)[a-zA-Z0-9/]`
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166
Romain Lafourcade124371c2024-01-07 15:08:31 +0100167syn match helpDiffAdded "\t[* ]Added\t\+[a-z].*"
168syn match helpDiffChanged "\t[* ]Changed\t\+[a-z].*"
169syn match helpDiffRemoved "\t[* ]Removed\t\+[a-z].*"
170
Bram Moolenaar071d4272004-06-13 20:20:40 +0000171" Additionally load a language-specific syntax file "help_ab.vim".
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000172let s:i = match(expand("%"), '\.\a\ax$')
173if s:i > 0
174 exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175endif
176
177syn sync minlines=40
178
179
180" Define the default highlighting.
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000181" Only used when an item doesn't have highlighting yet
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000182hi def link helpIgnore Ignore
Bram Moolenaar36782082013-11-28 13:53:34 +0100183hi def link helpHyperTextJump Identifier
Bram Moolenaar18144c82006-04-12 21:52:12 +0000184hi def link helpBar Ignore
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100185hi def link helpBacktick Ignore
Bram Moolenaar7fc904b2006-04-13 20:37:35 +0000186hi def link helpStar Ignore
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000187hi def link helpHyperTextEntry String
188hi def link helpHeadline Statement
189hi def link helpHeader PreProc
190hi def link helpSectionDelim PreProc
191hi def link helpVim Identifier
Bram Moolenaard38b0552012-04-25 19:07:41 +0200192hi def link helpCommand Comment
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000193hi def link helpExample Comment
194hi def link helpOption Type
195hi def link helpNotVi Special
196hi def link helpSpecial Special
197hi def link helpNote Todo
Bram Moolenaar64d8e252016-09-06 22:12:34 +0200198hi def link helpWarning Todo
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200199hi def link helpDeprecated Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000201hi def link helpComment Comment
202hi def link helpConstant Constant
203hi def link helpString String
204hi def link helpCharacter Character
205hi def link helpNumber Number
206hi def link helpBoolean Boolean
207hi def link helpFloat Float
208hi def link helpIdentifier Identifier
209hi def link helpFunction Function
210hi def link helpStatement Statement
211hi def link helpConditional Conditional
212hi def link helpRepeat Repeat
213hi def link helpLabel Label
214hi def link helpOperator Operator
215hi def link helpKeyword Keyword
216hi def link helpException Exception
217hi def link helpPreProc PreProc
218hi def link helpInclude Include
219hi def link helpDefine Define
220hi def link helpMacro Macro
221hi def link helpPreCondit PreCondit
222hi def link helpType Type
223hi def link helpStorageClass StorageClass
224hi def link helpStructure Structure
225hi def link helpTypedef Typedef
226hi def link helpSpecialChar SpecialChar
227hi def link helpTag Tag
228hi def link helpDelimiter Delimiter
229hi def link helpSpecialComment SpecialComment
230hi def link helpDebug Debug
231hi def link helpUnderlined Underlined
232hi def link helpError Error
233hi def link helpTodo Todo
Bram Moolenaare344bea2005-09-01 20:46:49 +0000234hi def link helpURL String
Romain Lafourcade124371c2024-01-07 15:08:31 +0100235hi def link helpDiffAdded Added
236hi def link helpDiffChanged Changed
237hi def link helpDiffRemoved Removed
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238
Bram Moolenaar2d8ed022022-05-21 13:08:16 +0100239if has('textprop') && expand('%:p') =~ '[/\\]doc[/\\]syntax.txt'
Bram Moolenaard899e512022-05-07 21:54:03 +0100240 " highlight groups with their respective color
241 import 'dist/vimhelp.vim'
242 call vimhelp.HighlightGroups()
243endif
244
Bram Moolenaar071d4272004-06-13 20:20:40 +0000245let b:current_syntax = "help"
246
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100247let &cpo = s:cpo_save
248unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249" vim: ts=8 sw=2