File: help.vim

package info (click to toggle)
vim 2%3A9.1.1882-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 92,504 kB
  • sloc: ansic: 432,444; cpp: 6,371; makefile: 4,596; sh: 2,387; java: 2,312; xml: 2,099; python: 1,559; perl: 1,419; awk: 730; lisp: 501; cs: 458; objc: 369; sed: 8; csh: 6
file content (314 lines) | stat: -rw-r--r-- 11,647 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
" Vim syntax file
" Language:		Vim help file
" Maintainer:		Doug Kearns <dougkearns@gmail.com>
" Last Change:		2025 Oct 19
" Former Maintainer:	Bram Moolenaar <Bram@vim.org>

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

syn iskeyword @,48-57,_,192-255

if !exists('g:help_example_languages')
  let g:help_example_languages = #{ vim: 'vim', vim9: 'vim' }
endif

syn match helpHeadline		"^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
syn match helpSectionDelim	"^===.*===$"
syn match helpSectionDelim	"^---.*--$"

if has("conceal")
  syn region helpExample	matchgroup=helpIgnore
        \ start="\%(^\| \)>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" concealends
 else
   syn region helpExample	matchgroup=helpIgnore
         \ start="\%(^\| \)>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<"
endif

for [s:lang, s:syntax] in g:help_example_languages->items()
  unlet! b:current_syntax

  if s:lang == "vim9"
    let b:vimsyn_force_vim9 = v:true
  endif

  " silent! to prevent E403
  execute 'silent! syn include' $'@helpExampleHighlight_{s:lang}'
        \ $'syntax/{s:syntax}.vim'

  if s:lang == "vim9"
    unlet b:vimsyn_force_vim9
  endif

  execute $'syn region helpExampleHighlight_{s:lang} matchgroup=helpIgnore'
        \ $'start=/\%(^\| \)>{s:lang}$/'
        \ 'end=/^[^ \t]/me=e-1 end=/^</'
        \ (has("conceal") ? 'concealends' : '')
        \ $'contains=@helpExampleHighlight_{s:lang} keepend'
endfor
unlet! s:lang s:syntax

if has_key(g:help_example_languages, "vim9")
  " for example at :help vim9-mix
  syn region vim9LegacyHeader_HelpExample
	\ start=+" legacy Vim script comments may go here+
	\ end="^\ze\s*vim9s\%[cript]\>"
	\ contains=@vimLegacyTop,vimComment,vimLineComment
  syn cluster helpExampleHighlight_vim9 add=vim9LegacyHeader_HelpExample
endif

" builtin.txt
syn region helpReturnType
      \ start="^\t\tReturn type: "
      \ end="^$"
      \ contains=@vimType,helpHyperTextJump,helpSpecial
      \ transparent
syn match helpSpecial		contained "{type}" containedin=vimCompoundType

" various.txt
syn region helpExCommand_Version
      \ start="^:ve\[rsion]\t\t"
      \ end="\n\ze\n:ve\[rsion] {nr}"
      \ contains=helpHyperTextEntry,helpHyperTextJump,helpOption

if has("ebcdic")
  syn match helpHyperTextJump	"\\\@<!|[^"*|]\+|" contains=helpBar
  syn match helpHyperTextEntry	"\*[^"*|]\+\*\s"he=e-1 contains=helpStar
  syn match helpHyperTextEntry	"\*[^"*|]\+\*$" contains=helpStar
else
  syn match helpHyperTextJump	"\\\@<!|[#-)!+-~]\+|" contains=helpBar
  syn match helpHyperTextEntry	"\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
  syn match helpHyperTextEntry	"\*[#-)!+-~]\+\*$" contains=helpStar
endif
if has("conceal")
  syn match helpBar		contained "|" conceal
  syn match helpBacktick	contained "`" conceal
  syn match helpStar		contained "\*" conceal
else
  syn match helpBar		contained "|"
  syn match helpBacktick	contained "`"
  syn match helpStar		contained "\*"
endif
syn match helpNormal		"|.*====*|"
syn match helpNormal		"|||"
syn match helpNormal		":|vim:|"	" for :help modeline
syn match helpVim		"\<Vim version [0-9][0-9.a-z]*"
syn match helpVim		"^\s\+\zsVIM - main help file$"
syn region helpVim		start="^\s\+VIM REFERENCE" end="^$"
syn region helpVim		start="^\s\+VIM USER MANUAL" end="^$"
syn match helpOption		"'[a-z]\{2,\}'"
syn match helpOption		"'t_..'"
syn match helpNormal		"'ab'"
syn match helpCommand		"`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
" doesn't allow a . directly after an ending backtick. See :helpgrep `[^`,]\+ [^`,]\+`\.
syn match helpCommand		"\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|[.?!]\?$\)"hs=s+1,he=e-1 contains=helpBacktick
syn match helpHeader		"\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
syn match helpGraphic		".* \ze`$" nextgroup=helpIgnore
if has("conceal")
  syn match helpIgnore		"." contained conceal
else
  syn match helpIgnore		"." contained
endif

" match 'iskeyword' word boundaries, '!-~,^*,^|,^",192-255'
let s:iskeyword =  '!#-)+-{}~\d192-\d255'
let s:start_word = $'\%(^\|[^{s:iskeyword}]\)\@1<='
let s:end_word =      $'\%([^{s:iskeyword}]\|$\)\@='

exec $'syn match helpNote	"{s:start_word}\%(note\|Note\|NOTE\|Notes\):\={s:end_word}"'
exec $'syn match helpNote       "\c[[(]note\%(:\|{s:end_word}\)"ms=s+1'
exec $'syn match helpWarning	"{s:start_word}\%(WARNING:\=\|Warning:\){s:end_word}"'
exec $'syn match helpDeprecated	"{s:start_word}\%(DEPRECATED:\=\|Deprecated:\){s:end_word}"'
exec $'syn match helpSpecial	"{s:start_word}N{s:end_word}"'
exec $'syn match helpSpecial	"{s:start_word}N\.$"me=e-1'
exec $'syn match helpSpecial	"{s:start_word}N\.\s"me=e-2'
exec $'syn match helpSpecial	"(N{s:end_word}"ms=s+1'
syn match helpSpecial		"\[N]"
" avoid highlighting N  N in quickref.txt
syn match helpSpecial		"N  N"he=s+1
syn match helpSpecial		"Nth"me=e-2
syn match helpSpecial		"N-1"me=e-2
" highlighting N for :resize in windows.txt
exec $'syn match helpSpecial	"] -N{s:end_word}"ms=s+3'
exec $'syn match helpSpecial	"+N{s:end_word}"ms=s+1'
exec $'syn match helpSpecial	"\[+-]N{s:end_word}"ms=s+4'

unlet s:iskeyword s:start_word s:end_word

" highlighting N of cinoptions-values in indent.txt
syn match helpSpecial		"^\t-\?\zsNs\?\s"me=s+1
" highlighting N of cinoptions-values in indent.txt
syn match helpSpecial		"^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1
syn match helpSpecial		"{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
syn match helpSpecial		"\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
syn match helpSpecial		"<[-a-zA-Z0-9_]\+>"
syn match helpSpecial		"<buffer=\w\+>"
syn match helpSpecial		"<[SCM]-.>"
syn match helpNormal		"<---*>"
syn match helpSpecial		"\[range]"
syn match helpSpecial		"\[line]"
syn match helpSpecial		"\[count]"
syn match helpSpecial		"\[offset]"
syn match helpSpecial		"\[cmd]"
syn match helpNormal		"vim9\[cmd]"
syn match helpSpecial		"\[num]"
syn match helpSpecial		"\[+num]"
syn match helpSpecial		"\[-num]"
syn match helpSpecial		"\[+cmd]"
syn match helpSpecial		"\[++opt]"
syn match helpSpecial		"\[++once]"
syn match helpSpecial		"\[++nested]"
syn match helpSpecial		"\[++t]"
syn match helpSpecial		"\[arg]"
syn match helpSpecial		"\[arguments]"
syn match helpSpecial		"\[ident]"
syn match helpSpecial		"\[addr]"
syn match helpSpecial		"\[group]"
" Don't highlight [converted] and others that do not have a tag
syn match helpNormal		"\[\(readonly\|fifo\|socket\|converted\|crypted\)]"

syn match helpSpecial		"CTRL-."
syn match helpSpecial		"CTRL-<\a\+>"
syn match helpSpecial		"CTRL-SHIFT-."
syn match helpSpecial		"CTRL-Break"
syn match helpSpecial		"CTRL-PageUp"
syn match helpSpecial		"CTRL-PageDown"
syn match helpSpecial		"CTRL-Insert"
syn match helpSpecial		"CTRL-Del"
syn match helpSpecial		"CTRL-{char}"
syn region helpNotVi		start="{Vi[: ]" start="{not" start="{only" end="}" contains=helpLeadBlank,helpHyperTextJump
syn match helpLeadBlank		"^\s\+" contained

" Highlight group items in their own color.
syn match helpComment		"\t[* ]Comment\t\+[a-z].*"
syn match helpConstant		"\t[* ]Constant\t\+[a-z].*"
syn match helpString		"\t[* ]String\t\+[a-z].*"
syn match helpCharacter		"\t[* ]Character\t\+[a-z].*"
syn match helpNumber		"\t[* ]Number\t\+[a-z].*"
syn match helpBoolean		"\t[* ]Boolean\t\+[a-z].*"
syn match helpFloat		"\t[* ]Float\t\+[a-z].*"
syn match helpIdentifier	"\t[* ]Identifier\t\+[a-z].*"
syn match helpFunction		"\t[* ]Function\t\+[a-z].*"
syn match helpStatement		"\t[* ]Statement\t\+[a-z].*"
syn match helpConditional	"\t[* ]Conditional\t\+[a-z].*"
syn match helpRepeat		"\t[* ]Repeat\t\+[a-z].*"
syn match helpLabel		"\t[* ]Label\t\+[a-z].*"
syn match helpOperator		"\t[* ]Operator\t\+["a-z].*"
syn match helpKeyword		"\t[* ]Keyword\t\+[a-z].*"
syn match helpException		"\t[* ]Exception\t\+[a-z].*"
syn match helpPreProc		"\t[* ]PreProc\t\+[a-z].*"
syn match helpInclude		"\t[* ]Include\t\+[a-z].*"
syn match helpDefine		"\t[* ]Define\t\+[a-z].*"
syn match helpMacro		"\t[* ]Macro\t\+[a-z].*"
syn match helpPreCondit		"\t[* ]PreCondit\t\+[a-z].*"
syn match helpType		"\t[* ]Type\t\+[a-z].*"
syn match helpStorageClass	"\t[* ]StorageClass\t\+[a-z].*"
syn match helpStructure		"\t[* ]Structure\t\+[a-z].*"
syn match helpTypedef		"\t[* ]Typedef\t\+[Aa-z].*"
syn match helpSpecial		"\t[* ]Special\t\+[a-z].*"
syn match helpSpecialChar	"\t[* ]SpecialChar\t\+[a-z].*"
syn match helpTag		"\t[* ]Tag\t\+[a-z].*"
syn match helpDelimiter		"\t[* ]Delimiter\t\+[a-z].*"
syn match helpSpecialComment	"\t[* ]SpecialComment\t\+[a-z].*"
syn match helpDebug		"\t[* ]Debug\t\+[a-z].*"
syn match helpUnderlined	"\t[* ]Underlined\t\+[a-z].*"
syn match helpBold		"\t[* ]Bold\t\+[a-z].*"
syn match helpItalic		"\t[* ]Italic\t\+[a-z].*"
syn match helpBoldItalic	"\t[* ]BoldItalic\t\+[a-z].*"
syn match helpError		"\t[* ]Error\t\+[a-z].*"
syn match helpTodo		"\t[* ]Todo\t\+[a-z].*"

syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'" \t<>{}]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'" \t<>{}]+)[a-zA-Z0-9/]`

syn match helpDiffAdded		"\t[* ]Added\t\+[a-z].*"
syn match helpDiffChanged	"\t[* ]Changed\t\+[a-z].*"
syn match helpDiffRemoved	"\t[* ]Removed\t\+[a-z].*"

" Additionally load a language-specific syntax file "help_ab.vim".
let s:i = match(expand("%"), '\.\a\ax$')
if s:i > 0
  exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
endif
unlet s:i

syn sync minlines=40


" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link helpIgnore		Ignore
hi def link helpHyperTextJump	Identifier
hi def link helpBar		Ignore
hi def link helpBacktick	Ignore
hi def link helpStar		Ignore
hi def link helpHyperTextEntry	String
hi def link helpHeadline	Statement
hi def link helpHeader		PreProc
hi def link helpSectionDelim	PreProc
hi def link helpVim		Identifier
hi def link helpCommand		Comment
hi def link helpExample		Comment
hi def link helpOption		Type
hi def link helpNotVi		Special
hi def link helpSpecial		Special
hi def link helpNote		Todo
hi def link helpWarning		Todo
hi def link helpDeprecated	Todo

hi def link helpComment		Comment
hi def link helpConstant	Constant
hi def link helpString		String
hi def link helpCharacter	Character
hi def link helpNumber		Number
hi def link helpBoolean		Boolean
hi def link helpFloat		Float
hi def link helpIdentifier	Identifier
hi def link helpFunction	Function
hi def link helpStatement	Statement
hi def link helpConditional	Conditional
hi def link helpRepeat		Repeat
hi def link helpLabel		Label
hi def link helpOperator	Operator
hi def link helpKeyword		Keyword
hi def link helpException	Exception
hi def link helpPreProc		PreProc
hi def link helpInclude		Include
hi def link helpDefine		Define
hi def link helpMacro		Macro
hi def link helpPreCondit	PreCondit
hi def link helpType		Type
hi def link helpStorageClass	StorageClass
hi def link helpStructure	Structure
hi def link helpTypedef		Typedef
hi def link helpSpecialChar	SpecialChar
hi def link helpTag		Tag
hi def link helpDelimiter	Delimiter
hi def link helpSpecialComment	SpecialComment
hi def link helpDebug		Debug
hi def link helpUnderlined	Underlined
hi def link helpBold		Bold
hi def link helpItalic		Italic
hi def link helpBoldItalic	BoldItalic
hi def link helpError		Error
hi def link helpTodo		Todo
hi def link helpURL		String
hi def link helpDiffAdded	Added
hi def link helpDiffChanged	Changed
hi def link helpDiffRemoved	Removed

if has('textprop') && expand('%:p') =~ '[/\\]doc[/\\]syntax.txt'
  " highlight groups with their respective color
  import 'dist/vimhelp.vim'
  call vimhelp.HighlightGroups()
endif

let b:current_syntax = "help"

let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8 sw=2