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