help.vim (9915B)
1 " Vim syntax file 2 " Language: Vim help file 3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 4 " Last Change: 2025 Jul 12 5 " Former Maintainer: Bram Moolenaar <Bram@vim.org> 6 7 " Quit when a (custom) syntax file was already loaded 8 if exists("b:current_syntax") 9 finish 10 endif 11 12 let s:cpo_save = &cpo 13 set cpo&vim 14 15 syn iskeyword @,48-57,_,192-255 16 17 if !exists('g:help_example_languages') 18 let g:help_example_languages = #{ vim: 'vim' } 19 endif 20 21 syn match helpHeadline "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)" 22 syn match helpSectionDelim "^===.*===$" 23 syn match helpSectionDelim "^---.*--$" 24 25 if has("conceal") 26 syn region helpExample matchgroup=helpIgnore 27 \ start="\%(^\| \)>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" concealends 28 else 29 syn region helpExample matchgroup=helpIgnore 30 \ start="\%(^\| \)>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" 31 endif 32 33 for [s:lang, s:syntax] in g:help_example_languages->items() 34 unlet! b:current_syntax 35 " silent! to prevent E403 36 execute 'silent! syn include' $'@helpExampleHighlight_{s:lang}' 37 \ $'syntax/{s:syntax}.vim' 38 39 execute $'syn region helpExampleHighlight_{s:lang} matchgroup=helpIgnore' 40 \ $'start=/\%(^\| \)>{s:lang}$/' 41 \ 'end=/^[^ \t]/me=e-1 end=/^</' 42 \ (has("conceal") ? 'concealends' : '') 43 \ $'contains=@helpExampleHighlight_{s:lang} keepend' 44 endfor 45 unlet! s:lang s:syntax 46 47 syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" contains=helpBar 48 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar 49 syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" contains=helpStar 50 if has("conceal") 51 syn match helpBar contained "|" conceal 52 syn match helpBacktick contained "`" conceal 53 syn match helpStar contained "\*" conceal 54 else 55 syn match helpBar contained "|" 56 syn match helpBacktick contained "`" 57 syn match helpStar contained "\*" 58 endif 59 syn match helpNormal "|.*====*|" 60 syn match helpNormal "|||" 61 syn match helpNormal ":|vim:|" " for :help modeline 62 syn match helpVim "\<Vim version [0-9][0-9.a-z]*" 63 syn match helpVim "^\s\+\zsNVIM - help$" 64 syn region helpVim start="^\s\+N\?VIM REFERENCE" end="^$" 65 syn region helpVim start="^\s\+VIM USER MANUAL" end="^$" 66 syn match helpOption "'[a-z]\{2,\}'" 67 syn match helpOption "'t_..'" 68 syn match helpNormal "'ab'" 69 syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick 70 " doesn't allow a . directly after an ending backtick. See :helpgrep `[^`,]\+ [^`,]\+`\. 71 syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|[.?!]\?$\)"hs=s+1,he=e-1 contains=helpBacktick 72 syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore 73 syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore 74 if has("conceal") 75 syn match helpIgnore "." contained conceal 76 else 77 syn match helpIgnore "." contained 78 endif 79 80 " match 'iskeyword' word boundaries, '!-~,^*,^|,^",192-255' 81 let s:iskeyword = '!#-)+-{}~\d192-\d255' 82 let s:start_word = $'\%(^\|[^{s:iskeyword}]\)\@1<=' 83 let s:end_word = $'\%([^{s:iskeyword}]\|$\)\@=' 84 85 exec $'syn match helpNote "{s:start_word}\%(note\|Note\|NOTE\|Notes\):\={s:end_word}"' 86 exec $'syn match helpNote "\c[[(]note\%(:\|{s:end_word}\)"ms=s+1' 87 exec $'syn match helpWarning "{s:start_word}\%(WARNING:\=\|Warning:\){s:end_word}"' 88 exec $'syn match helpDeprecated "{s:start_word}\%(DEPRECATED:\=\|Deprecated:\){s:end_word}"' 89 exec $'syn match helpSpecial "{s:start_word}N{s:end_word}"' 90 exec $'syn match helpSpecial "{s:start_word}N\.$"me=e-1' 91 exec $'syn match helpSpecial "{s:start_word}N\.\s"me=e-2' 92 exec $'syn match helpSpecial "(N{s:end_word}"ms=s+1' 93 syn match helpSpecial "\[N]" 94 " avoid highlighting N N in quickref.txt 95 syn match helpSpecial "N N"he=s+1 96 syn match helpSpecial "Nth"me=e-2 97 syn match helpSpecial "N-1"me=e-2 98 " highlighting N for :resize in windows.txt 99 exec $'syn match helpSpecial "] -N{s:end_word}"ms=s+3' 100 exec $'syn match helpSpecial "+N{s:end_word}"ms=s+1' 101 exec $'syn match helpSpecial "\[+-]N{s:end_word}"ms=s+4' 102 103 unlet s:iskeyword s:start_word s:end_word 104 105 " highlighting N of cinoptions-values in indent.txt 106 syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1 107 " highlighting N of cinoptions-values in indent.txt 108 syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1 109 syn match helpSpecial "{[-_a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}" 110 syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1 111 syn match helpSpecial "<[-a-zA-Z0-9_]\+>" 112 syn match helpSpecial "<buffer=\w\+>" 113 syn match helpSpecial "<[SCM]-.>" 114 syn match helpNormal "<---*>" 115 syn match helpSpecial "\[range]" 116 syn match helpSpecial "\[line]" 117 syn match helpSpecial "\[count]" 118 syn match helpSpecial "\[offset]" 119 syn match helpSpecial "\[cmd]" 120 syn match helpSpecial "\[num]" 121 syn match helpSpecial "\[+num]" 122 syn match helpSpecial "\[-num]" 123 syn match helpSpecial "\[+cmd]" 124 syn match helpSpecial "\[++opt]" 125 syn match helpSpecial "\[++once]" 126 syn match helpSpecial "\[++nested]" 127 syn match helpSpecial "\[++t]" 128 syn match helpSpecial "\[arg]" 129 syn match helpSpecial "\[arguments]" 130 syn match helpSpecial "\[ident]" 131 syn match helpSpecial "\[addr]" 132 syn match helpSpecial "\[group]" 133 " Don't highlight [converted] and others that do not have a tag 134 syn match helpNormal "\[\(readonly\|fifo\|socket\|converted\|crypted\)]" 135 136 syn match helpSpecial "CTRL-." 137 syn match helpSpecial "CTRL-<\a\+>" 138 syn match helpSpecial "CTRL-SHIFT-." 139 syn match helpSpecial "CTRL-Break" 140 syn match helpSpecial "CTRL-PageUp" 141 syn match helpSpecial "CTRL-PageDown" 142 syn match helpSpecial "CTRL-Insert" 143 syn match helpSpecial "CTRL-Del" 144 syn match helpSpecial "CTRL-{char}" 145 syn match helpSpecial "META-." 146 syn match helpSpecial "ALT-." 147 148 " Highlight group items in their own color. 149 syn match helpComment "\t[* ]Comment\t\+[a-z].*" 150 syn match helpConstant "\t[* ]Constant\t\+[a-z].*" 151 syn match helpString "\t[* ]String\t\+[a-z].*" 152 syn match helpCharacter "\t[* ]Character\t\+[a-z].*" 153 syn match helpNumber "\t[* ]Number\t\+[a-z].*" 154 syn match helpBoolean "\t[* ]Boolean\t\+[a-z].*" 155 syn match helpFloat "\t[* ]Float\t\+[a-z].*" 156 syn match helpIdentifier "\t[* ]Identifier\t\+[a-z].*" 157 syn match helpFunction "\t[* ]Function\t\+[a-z].*" 158 syn match helpStatement "\t[* ]Statement\t\+[a-z].*" 159 syn match helpConditional "\t[* ]Conditional\t\+[a-z].*" 160 syn match helpRepeat "\t[* ]Repeat\t\+[a-z].*" 161 syn match helpLabel "\t[* ]Label\t\+[a-z].*" 162 syn match helpOperator "\t[* ]Operator\t\+["a-z].*" 163 syn match helpKeyword "\t[* ]Keyword\t\+[a-z].*" 164 syn match helpException "\t[* ]Exception\t\+[a-z].*" 165 syn match helpPreProc "\t[* ]PreProc\t\+[a-z].*" 166 syn match helpInclude "\t[* ]Include\t\+[a-z].*" 167 syn match helpDefine "\t[* ]Define\t\+[a-z].*" 168 syn match helpMacro "\t[* ]Macro\t\+[a-z].*" 169 syn match helpPreCondit "\t[* ]PreCondit\t\+[a-z].*" 170 syn match helpType "\t[* ]Type\t\+[a-z].*" 171 syn match helpStorageClass "\t[* ]StorageClass\t\+[a-z].*" 172 syn match helpStructure "\t[* ]Structure\t\+[a-z].*" 173 syn match helpTypedef "\t[* ]Typedef\t\+[Aa-z].*" 174 syn match helpSpecial "\t[* ]Special\t\+[a-z].*" 175 syn match helpSpecialChar "\t[* ]SpecialChar\t\+[a-z].*" 176 syn match helpTag "\t[* ]Tag\t\+[a-z].*" 177 syn match helpDelimiter "\t[* ]Delimiter\t\+[a-z].*" 178 syn match helpSpecialComment "\t[* ]SpecialComment\t\+[a-z].*" 179 syn match helpDebug "\t[* ]Debug\t\+[a-z].*" 180 syn match helpUnderlined "\t[* ]Underlined\t\+[a-z].*" 181 syn match helpError "\t[* ]Error\t\+[a-z].*" 182 syn match helpTodo "\t[* ]Todo\t\+[a-z].*" 183 184 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/]` 185 186 syn match helpDiffAdded "\t[* ]Added\t\+[a-z].*" 187 syn match helpDiffChanged "\t[* ]Changed\t\+[a-z].*" 188 syn match helpDiffRemoved "\t[* ]Removed\t\+[a-z].*" 189 190 " Additionally load a language-specific syntax file "help_ab.vim". 191 let s:i = match(expand("%"), '\.\a\ax$') 192 if s:i > 0 193 exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim" 194 endif 195 unlet s:i 196 197 syn sync minlines=40 198 199 200 " Define the default highlighting. 201 " Only used when an item doesn't have highlighting yet 202 hi def link helpIgnore Ignore 203 hi def link helpHyperTextJump Identifier 204 hi def link helpBar Ignore 205 hi def link helpBacktick Ignore 206 hi def link helpStar Ignore 207 hi def link helpHyperTextEntry String 208 hi def link helpHeadline Statement 209 hi def link helpHeader PreProc 210 hi def link helpSectionDelim PreProc 211 hi def link helpVim Identifier 212 hi def link helpCommand Comment 213 hi def link helpExample Comment 214 hi def link helpOption Type 215 hi def link helpSpecial Special 216 hi def link helpNote Todo 217 hi def link helpWarning Todo 218 hi def link helpDeprecated Todo 219 220 hi def link helpComment Comment 221 hi def link helpConstant Constant 222 hi def link helpString String 223 hi def link helpCharacter Character 224 hi def link helpNumber Number 225 hi def link helpBoolean Boolean 226 hi def link helpFloat Float 227 hi def link helpIdentifier Identifier 228 hi def link helpFunction Function 229 hi def link helpStatement Statement 230 hi def link helpConditional Conditional 231 hi def link helpRepeat Repeat 232 hi def link helpLabel Label 233 hi def link helpOperator Operator 234 hi def link helpKeyword Keyword 235 hi def link helpException Exception 236 hi def link helpPreProc PreProc 237 hi def link helpInclude Include 238 hi def link helpDefine Define 239 hi def link helpMacro Macro 240 hi def link helpPreCondit PreCondit 241 hi def link helpType Type 242 hi def link helpStorageClass StorageClass 243 hi def link helpStructure Structure 244 hi def link helpTypedef Typedef 245 hi def link helpSpecialChar SpecialChar 246 hi def link helpTag Tag 247 hi def link helpDelimiter Delimiter 248 hi def link helpSpecialComment SpecialComment 249 hi def link helpDebug Debug 250 hi def link helpUnderlined Underlined 251 hi def link helpError Error 252 hi def link helpTodo Todo 253 hi def link helpURL String 254 hi def link helpDiffAdded Added 255 hi def link helpDiffChanged Changed 256 hi def link helpDiffRemoved Removed 257 258 let b:current_syntax = "help" 259 260 let &cpo = s:cpo_save 261 unlet s:cpo_save 262 " vim: ts=8 sw=2