Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Vim help file |
| 3 | " Maintainer: Bram Moolenaar (Bram@vim.org) |
| 4 | " Last Change: 2004 May 17 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | syn match helpHeadline "^[A-Z ]\+[ ]\+\*"me=e-1 |
| 15 | syn match helpSectionDelim "^=\{3,}.*===$" |
| 16 | syn match helpSectionDelim "^-\{3,}.*--$" |
| 17 | syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<" |
| 18 | if has("ebcdic") |
| 19 | syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" |
| 20 | syn match helpHyperTextEntry "\*[^"*|]\+\*\s"he=e-1 |
| 21 | syn match helpHyperTextEntry "\*[^"*|]\+\*$" |
| 22 | else |
| 23 | syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" |
| 24 | syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 |
| 25 | syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" |
| 26 | endif |
| 27 | syn match helpNormal "|.*====*|" |
| 28 | syn match helpNormal ":|vim:|" " for :help modeline |
| 29 | syn match helpVim "Vim version [0-9.a-z]\+" |
| 30 | syn match helpVim "VIM REFERENCE.*" |
| 31 | syn match helpOption "'[a-z]\{2,\}'" |
| 32 | syn match helpOption "'t_..'" |
| 33 | syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore |
| 34 | syn match helpIgnore "." contained |
| 35 | syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes: |
| 36 | syn match helpSpecial "\<N\>" |
| 37 | syn match helpSpecial "\<N\.$"me=e-1 |
| 38 | syn match helpSpecial "\<N\.\s"me=e-2 |
| 39 | syn match helpSpecial "(N\>"ms=s+1 |
| 40 | syn match helpSpecial "\[N]" |
| 41 | " avoid highlighting N N in help.txt |
| 42 | syn match helpSpecial "N N"he=s+1 |
| 43 | syn match helpSpecial "Nth"me=e-2 |
| 44 | syn match helpSpecial "N-1"me=e-2 |
| 45 | syn match helpSpecial "{[-a-zA-Z0-9'":%#=[\]<>.,]\+}" |
| 46 | syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}" |
| 47 | syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1 |
| 48 | syn match helpSpecial "<[-a-zA-Z0-9_]\+>" |
| 49 | syn match helpSpecial "<[SCM]-.>" |
| 50 | syn match helpNormal "<---*>" |
| 51 | syn match helpSpecial "\[range]" |
| 52 | syn match helpSpecial "\[line]" |
| 53 | syn match helpSpecial "\[count]" |
| 54 | syn match helpSpecial "\[offset]" |
| 55 | syn match helpSpecial "\[cmd]" |
| 56 | syn match helpSpecial "\[num]" |
| 57 | syn match helpSpecial "\[+num]" |
| 58 | syn match helpSpecial "\[-num]" |
| 59 | syn match helpSpecial "\[+cmd]" |
| 60 | syn match helpSpecial "\[++opt]" |
| 61 | syn match helpSpecial "\[arg]" |
| 62 | syn match helpSpecial "\[arguments]" |
| 63 | syn match helpSpecial "\[ident]" |
| 64 | syn match helpSpecial "\[addr]" |
| 65 | syn match helpSpecial "\[group]" |
| 66 | syn match helpSpecial "CTRL-." |
| 67 | syn match helpSpecial "CTRL-Break" |
| 68 | syn match helpSpecial "CTRL-PageUp" |
| 69 | syn match helpSpecial "CTRL-PageDown" |
| 70 | syn match helpSpecial "CTRL-Insert" |
| 71 | syn match helpSpecial "CTRL-Del" |
| 72 | syn match helpSpecial "CTRL-{char}" |
| 73 | syn region helpNotVi start="{Vi[: ]" start="{not" start="{only" end="}" contains=helpLeadBlank,helpHyperTextJump |
| 74 | syn match helpLeadBlank "^\s\+" contained |
| 75 | |
| 76 | " Highlight group items in their own color. |
| 77 | syn match helpComment "\t[* ]Comment\t\+[a-z].*" |
| 78 | syn match helpConstant "\t[* ]Constant\t\+[a-z].*" |
| 79 | syn match helpString "\t[* ]String\t\+[a-z].*" |
| 80 | syn match helpCharacter "\t[* ]Character\t\+[a-z].*" |
| 81 | syn match helpNumber "\t[* ]Number\t\+[a-z].*" |
| 82 | syn match helpBoolean "\t[* ]Boolean\t\+[a-z].*" |
| 83 | syn match helpFloat "\t[* ]Float\t\+[a-z].*" |
| 84 | syn match helpIdentifier "\t[* ]Identifier\t\+[a-z].*" |
| 85 | syn match helpFunction "\t[* ]Function\t\+[a-z].*" |
| 86 | syn match helpStatement "\t[* ]Statement\t\+[a-z].*" |
| 87 | syn match helpConditional "\t[* ]Conditional\t\+[a-z].*" |
| 88 | syn match helpRepeat "\t[* ]Repeat\t\+[a-z].*" |
| 89 | syn match helpLabel "\t[* ]Label\t\+[a-z].*" |
| 90 | syn match helpOperator "\t[* ]Operator\t\+["a-z].*" |
| 91 | syn match helpKeyword "\t[* ]Keyword\t\+[a-z].*" |
| 92 | syn match helpException "\t[* ]Exception\t\+[a-z].*" |
| 93 | syn match helpPreProc "\t[* ]PreProc\t\+[a-z].*" |
| 94 | syn match helpInclude "\t[* ]Include\t\+[a-z].*" |
| 95 | syn match helpDefine "\t[* ]Define\t\+[a-z].*" |
| 96 | syn match helpMacro "\t[* ]Macro\t\+[a-z].*" |
| 97 | syn match helpPreCondit "\t[* ]PreCondit\t\+[a-z].*" |
| 98 | syn match helpType "\t[* ]Type\t\+[a-z].*" |
| 99 | syn match helpStorageClass "\t[* ]StorageClass\t\+[a-z].*" |
| 100 | syn match helpStructure "\t[* ]Structure\t\+[a-z].*" |
| 101 | syn match helpTypedef "\t[* ]Typedef\t\+[Aa-z].*" |
| 102 | syn match helpSpecial "\t[* ]Special\t\+[a-z].*" |
| 103 | syn match helpSpecialChar "\t[* ]SpecialChar\t\+[a-z].*" |
| 104 | syn match helpTag "\t[* ]Tag\t\+[a-z].*" |
| 105 | syn match helpDelimiter "\t[* ]Delimiter\t\+[a-z].*" |
| 106 | syn match helpSpecialComment "\t[* ]SpecialComment\t\+[a-z].*" |
| 107 | syn match helpDebug "\t[* ]Debug\t\+[a-z].*" |
| 108 | syn match helpUnderlined "\t[* ]Underlined\t\+[a-z].*" |
| 109 | syn match helpError "\t[* ]Error\t\+[a-z].*" |
| 110 | syn match helpTodo "\t[* ]Todo\t\+[a-z].*" |
| 111 | |
| 112 | |
| 113 | " Additionally load a language-specific syntax file "help_ab.vim". |
| 114 | let i = match(expand("%"), '\.\a\ax$') |
| 115 | if i > 0 |
| 116 | exe "runtime syntax/help_" . strpart(expand("%"), i + 1, 2) . ".vim" |
| 117 | endif |
| 118 | |
| 119 | syn sync minlines=40 |
| 120 | |
| 121 | |
| 122 | " Define the default highlighting. |
| 123 | " For version 5.7 and earlier: only when not done already |
| 124 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 125 | if version >= 508 || !exists("did_help_syntax_inits") |
| 126 | if version < 508 |
| 127 | let did_help_syntax_inits = 1 |
| 128 | command -nargs=+ HiLink hi link <args> |
| 129 | else |
| 130 | command -nargs=+ HiLink hi def link <args> |
| 131 | endif |
| 132 | |
| 133 | HiLink helpExampleStart helpIgnore |
| 134 | HiLink helpIgnore Ignore |
| 135 | HiLink helpHyperTextJump Subtitle |
| 136 | HiLink helpHyperTextEntry String |
| 137 | HiLink helpHeadline Statement |
| 138 | HiLink helpHeader PreProc |
| 139 | HiLink helpSectionDelim PreProc |
| 140 | HiLink helpVim Identifier |
| 141 | HiLink helpExample Comment |
| 142 | HiLink helpOption Type |
| 143 | HiLink helpNotVi Special |
| 144 | HiLink helpSpecial Special |
| 145 | HiLink helpNote Todo |
| 146 | HiLink Subtitle Identifier |
| 147 | |
| 148 | HiLink helpComment Comment |
| 149 | HiLink helpConstant Constant |
| 150 | HiLink helpString String |
| 151 | HiLink helpCharacter Character |
| 152 | HiLink helpNumber Number |
| 153 | HiLink helpBoolean Boolean |
| 154 | HiLink helpFloat Float |
| 155 | HiLink helpIdentifier Identifier |
| 156 | HiLink helpFunction Function |
| 157 | HiLink helpStatement Statement |
| 158 | HiLink helpConditional Conditional |
| 159 | HiLink helpRepeat Repeat |
| 160 | HiLink helpLabel Label |
| 161 | HiLink helpOperator Operator |
| 162 | HiLink helpKeyword Keyword |
| 163 | HiLink helpException Exception |
| 164 | HiLink helpPreProc PreProc |
| 165 | HiLink helpInclude Include |
| 166 | HiLink helpDefine Define |
| 167 | HiLink helpMacro Macro |
| 168 | HiLink helpPreCondit PreCondit |
| 169 | HiLink helpType Type |
| 170 | HiLink helpStorageClass StorageClass |
| 171 | HiLink helpStructure Structure |
| 172 | HiLink helpTypedef Typedef |
| 173 | HiLink helpSpecialChar SpecialChar |
| 174 | HiLink helpTag Tag |
| 175 | HiLink helpDelimiter Delimiter |
| 176 | HiLink helpSpecialComment SpecialComment |
| 177 | HiLink helpDebug Debug |
| 178 | HiLink helpUnderlined Underlined |
| 179 | HiLink helpError Error |
| 180 | HiLink helpTodo Todo |
| 181 | |
| 182 | delcommand HiLink |
| 183 | endif |
| 184 | |
| 185 | let b:current_syntax = "help" |
| 186 | |
| 187 | " vim: ts=8 sw=2 |