blob: 2f71427c8c97bca6a38bdc176c1258bb4abf3514 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Vim help file
3" Maintainer: Bram Moolenaar (Bram@vim.org)
Bram Moolenaar6ebe4f92022-10-28 20:47:54 +01004" Last Change: 2022 Oct 17
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
Bram Moolenaard857f0e2005-06-21 22:37:39 +00006" Quit when a (custom) syntax file was already loaded
7if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00008 finish
9endif
10
Bram Moolenaar6ee8d892012-01-10 14:55:01 +010011let s:cpo_save = &cpo
12set cpo&vim
13
Bram Moolenaar6ebe4f92022-10-28 20:47:54 +010014syn match helpHeadline "^ *[-A-Z.][-A-Z0-9 .()_]*?\=\ze\(\s\+\*\|$\)"
Bram Moolenaar6c35bea2012-07-25 17:49:10 +020015syn match helpSectionDelim "^===.*===$"
16syn match helpSectionDelim "^---.*--$"
Bram Moolenaardd007ed2013-07-09 15:44:17 +020017if 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000022if has("ebcdic")
Bram Moolenaar18144c82006-04-12 21:52:12 +000023 syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" contains=helpBar
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000024 syn match helpHyperTextEntry "\*[^"*|]\+\*\s"he=e-1 contains=helpStar
25 syn match helpHyperTextEntry "\*[^"*|]\+\*$" contains=helpStar
Bram Moolenaar071d4272004-06-13 20:20:40 +000026else
Bram Moolenaar18144c82006-04-12 21:52:12 +000027 syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" contains=helpBar
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000028 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
29 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" contains=helpStar
Bram Moolenaar071d4272004-06-13 20:20:40 +000030endif
Bram Moolenaar97293012011-07-18 19:40:27 +020031if has("conceal")
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010032 syn match helpBar contained "|" conceal
33 syn match helpBacktick contained "`" conceal
Bram Moolenaar97293012011-07-18 19:40:27 +020034 syn match helpStar contained "\*" conceal
35else
Bram Moolenaarfa13eef2013-02-06 17:34:04 +010036 syn match helpBar contained "|"
37 syn match helpBacktick contained "`"
Bram Moolenaar97293012011-07-18 19:40:27 +020038 syn match helpStar contained "\*"
39endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000040syn match helpNormal "|.*====*|"
Bram Moolenaarf1568ec2011-12-14 21:17:39 +010041syn match helpNormal "|||"
Bram Moolenaar071d4272004-06-13 20:20:40 +000042syn match helpNormal ":|vim:|" " for :help modeline
Bram Moolenaar251835e2014-02-24 02:51:51 +010043syn match helpVim "\<Vim version [0-9][0-9.a-z]*"
Bram Moolenaar071d4272004-06-13 20:20:40 +000044syn match helpVim "VIM REFERENCE.*"
45syn match helpOption "'[a-z]\{2,\}'"
46syn match helpOption "'t_..'"
Bram Moolenaar9fbdbb82022-09-27 17:30:34 +010047syn match helpNormal "'ab'"
Bram Moolenaar7cba6c02013-09-05 22:13:31 +020048syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
Bram Moolenaar939a1ab2016-04-10 01:31:25 +020049syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
Bram Moolenaar071d4272004-06-13 20:20:40 +000050syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
Bram Moolenaar166af9b2010-11-16 20:34:40 +010051syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
Bram Moolenaar97293012011-07-18 19:40:27 +020052if has("conceal")
53 syn match helpIgnore "." contained conceal
54else
55 syn match helpIgnore "." contained
56endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000057syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes:
Bram Moolenaar3ec574f2017-06-13 18:12:01 +020058syn keyword helpWarning WARNING WARNING: Warning:
59syn keyword helpDeprecated DEPRECATED DEPRECATED: Deprecated:
Bram Moolenaar071d4272004-06-13 20:20:40 +000060syn match helpSpecial "\<N\>"
61syn match helpSpecial "\<N\.$"me=e-1
62syn match helpSpecial "\<N\.\s"me=e-2
63syn match helpSpecial "(N\>"ms=s+1
Bram Moolenaar01164a62017-11-02 22:58:42 +010064
Bram Moolenaar071d4272004-06-13 20:20:40 +000065syn match helpSpecial "\[N]"
66" avoid highlighting N N in help.txt
67syn match helpSpecial "N N"he=s+1
68syn match helpSpecial "Nth"me=e-2
69syn match helpSpecial "N-1"me=e-2
Bram Moolenaar071d4272004-06-13 20:20:40 +000070syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
71syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
72syn match helpSpecial "<[-a-zA-Z0-9_]\+>"
73syn match helpSpecial "<[SCM]-.>"
74syn match helpNormal "<---*>"
75syn match helpSpecial "\[range]"
76syn match helpSpecial "\[line]"
77syn match helpSpecial "\[count]"
78syn match helpSpecial "\[offset]"
79syn match helpSpecial "\[cmd]"
Bram Moolenaar4d8f4762021-06-27 15:18:56 +020080syn match helpNormal "vim9\[cmd]"
Bram Moolenaar071d4272004-06-13 20:20:40 +000081syn match helpSpecial "\[num]"
82syn match helpSpecial "\[+num]"
83syn match helpSpecial "\[-num]"
84syn match helpSpecial "\[+cmd]"
85syn match helpSpecial "\[++opt]"
86syn match helpSpecial "\[arg]"
87syn match helpSpecial "\[arguments]"
88syn match helpSpecial "\[ident]"
89syn match helpSpecial "\[addr]"
90syn match helpSpecial "\[group]"
Bram Moolenaar01164a62017-11-02 22:58:42 +010091" Don't highlight [converted] and others that do not have a tag
92syn match helpNormal "\[\(readonly\|fifo\|socket\|converted\|crypted\)]"
93
Bram Moolenaar071d4272004-06-13 20:20:40 +000094syn match helpSpecial "CTRL-."
Bram Moolenaar0c0734d2019-11-26 21:44:46 +010095syn match helpSpecial "CTRL-SHIFT-."
Bram Moolenaar071d4272004-06-13 20:20:40 +000096syn match helpSpecial "CTRL-Break"
97syn match helpSpecial "CTRL-PageUp"
98syn match helpSpecial "CTRL-PageDown"
99syn match helpSpecial "CTRL-Insert"
100syn match helpSpecial "CTRL-Del"
101syn match helpSpecial "CTRL-{char}"
102syn region helpNotVi start="{Vi[: ]" start="{not" start="{only" end="}" contains=helpLeadBlank,helpHyperTextJump
103syn match helpLeadBlank "^\s\+" contained
104
105" Highlight group items in their own color.
106syn match helpComment "\t[* ]Comment\t\+[a-z].*"
107syn match helpConstant "\t[* ]Constant\t\+[a-z].*"
108syn match helpString "\t[* ]String\t\+[a-z].*"
109syn match helpCharacter "\t[* ]Character\t\+[a-z].*"
110syn match helpNumber "\t[* ]Number\t\+[a-z].*"
111syn match helpBoolean "\t[* ]Boolean\t\+[a-z].*"
112syn match helpFloat "\t[* ]Float\t\+[a-z].*"
113syn match helpIdentifier "\t[* ]Identifier\t\+[a-z].*"
114syn match helpFunction "\t[* ]Function\t\+[a-z].*"
115syn match helpStatement "\t[* ]Statement\t\+[a-z].*"
116syn match helpConditional "\t[* ]Conditional\t\+[a-z].*"
117syn match helpRepeat "\t[* ]Repeat\t\+[a-z].*"
118syn match helpLabel "\t[* ]Label\t\+[a-z].*"
119syn match helpOperator "\t[* ]Operator\t\+["a-z].*"
120syn match helpKeyword "\t[* ]Keyword\t\+[a-z].*"
121syn match helpException "\t[* ]Exception\t\+[a-z].*"
122syn match helpPreProc "\t[* ]PreProc\t\+[a-z].*"
123syn match helpInclude "\t[* ]Include\t\+[a-z].*"
124syn match helpDefine "\t[* ]Define\t\+[a-z].*"
125syn match helpMacro "\t[* ]Macro\t\+[a-z].*"
126syn match helpPreCondit "\t[* ]PreCondit\t\+[a-z].*"
127syn match helpType "\t[* ]Type\t\+[a-z].*"
128syn match helpStorageClass "\t[* ]StorageClass\t\+[a-z].*"
129syn match helpStructure "\t[* ]Structure\t\+[a-z].*"
130syn match helpTypedef "\t[* ]Typedef\t\+[Aa-z].*"
131syn match helpSpecial "\t[* ]Special\t\+[a-z].*"
132syn match helpSpecialChar "\t[* ]SpecialChar\t\+[a-z].*"
133syn match helpTag "\t[* ]Tag\t\+[a-z].*"
134syn match helpDelimiter "\t[* ]Delimiter\t\+[a-z].*"
135syn match helpSpecialComment "\t[* ]SpecialComment\t\+[a-z].*"
136syn match helpDebug "\t[* ]Debug\t\+[a-z].*"
137syn match helpUnderlined "\t[* ]Underlined\t\+[a-z].*"
138syn match helpError "\t[* ]Error\t\+[a-z].*"
139syn match helpTodo "\t[* ]Todo\t\+[a-z].*"
140
Bram Moolenaar3991dab2006-03-27 17:01:56 +0000141syn 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 +0000142
143" Additionally load a language-specific syntax file "help_ab.vim".
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000144let s:i = match(expand("%"), '\.\a\ax$')
145if s:i > 0
146 exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000147endif
148
Bram Moolenaard04b7502010-07-08 22:27:55 +0200149" Italian
Bram Moolenaar7abcaab2010-07-12 23:05:41 +0200150if v:lang =~ '\<IT\>' || v:lang =~ '_IT\>' || v:lang =~? "italian"
151 syn keyword helpNote nota Nota NOTA nota: Nota: NOTA: notare Notare NOTARE notare: Notare: NOTARE:
Bram Moolenaard04b7502010-07-08 22:27:55 +0200152 syn match helpSpecial "Nma"me=e-2
153 syn match helpSpecial "Nme"me=e-2
154 syn match helpSpecial "Nmi"me=e-2
155 syn match helpSpecial "Nmo"me=e-2
156 syn match helpSpecial "\[interv.]"
157 syn region helpNotVi start="{non" start="{solo" start="{disponibile" end="}" contains=helpLeadBlank,helpHyperTextJump
158endif
159
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160syn sync minlines=40
161
162
163" Define the default highlighting.
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000164" Only used when an item doesn't have highlighting yet
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000165hi def link helpIgnore Ignore
Bram Moolenaar36782082013-11-28 13:53:34 +0100166hi def link helpHyperTextJump Identifier
Bram Moolenaar18144c82006-04-12 21:52:12 +0000167hi def link helpBar Ignore
Bram Moolenaarfa13eef2013-02-06 17:34:04 +0100168hi def link helpBacktick Ignore
Bram Moolenaar7fc904b2006-04-13 20:37:35 +0000169hi def link helpStar Ignore
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000170hi def link helpHyperTextEntry String
171hi def link helpHeadline Statement
172hi def link helpHeader PreProc
173hi def link helpSectionDelim PreProc
174hi def link helpVim Identifier
Bram Moolenaard38b0552012-04-25 19:07:41 +0200175hi def link helpCommand Comment
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000176hi def link helpExample Comment
177hi def link helpOption Type
178hi def link helpNotVi Special
179hi def link helpSpecial Special
180hi def link helpNote Todo
Bram Moolenaar64d8e252016-09-06 22:12:34 +0200181hi def link helpWarning Todo
Bram Moolenaar3ec574f2017-06-13 18:12:01 +0200182hi def link helpDeprecated Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183
Bram Moolenaard857f0e2005-06-21 22:37:39 +0000184hi def link helpComment Comment
185hi def link helpConstant Constant
186hi def link helpString String
187hi def link helpCharacter Character
188hi def link helpNumber Number
189hi def link helpBoolean Boolean
190hi def link helpFloat Float
191hi def link helpIdentifier Identifier
192hi def link helpFunction Function
193hi def link helpStatement Statement
194hi def link helpConditional Conditional
195hi def link helpRepeat Repeat
196hi def link helpLabel Label
197hi def link helpOperator Operator
198hi def link helpKeyword Keyword
199hi def link helpException Exception
200hi def link helpPreProc PreProc
201hi def link helpInclude Include
202hi def link helpDefine Define
203hi def link helpMacro Macro
204hi def link helpPreCondit PreCondit
205hi def link helpType Type
206hi def link helpStorageClass StorageClass
207hi def link helpStructure Structure
208hi def link helpTypedef Typedef
209hi def link helpSpecialChar SpecialChar
210hi def link helpTag Tag
211hi def link helpDelimiter Delimiter
212hi def link helpSpecialComment SpecialComment
213hi def link helpDebug Debug
214hi def link helpUnderlined Underlined
215hi def link helpError Error
216hi def link helpTodo Todo
Bram Moolenaare344bea2005-09-01 20:46:49 +0000217hi def link helpURL String
Bram Moolenaar071d4272004-06-13 20:20:40 +0000218
Bram Moolenaar2d8ed022022-05-21 13:08:16 +0100219if has('textprop') && expand('%:p') =~ '[/\\]doc[/\\]syntax.txt'
Bram Moolenaard899e512022-05-07 21:54:03 +0100220 " highlight groups with their respective color
221 import 'dist/vimhelp.vim'
222 call vimhelp.HighlightGroups()
223endif
224
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225let b:current_syntax = "help"
226
Bram Moolenaar6ee8d892012-01-10 14:55:01 +0100227let &cpo = s:cpo_save
228unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229" vim: ts=8 sw=2