1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-17 23:37:08 +01:00
vim/runtime/syntax/help.vim

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

260 lines
9.5 KiB
VimL
Raw Permalink Normal View History

2004-06-13 20:20:40 +00:00
" Vim syntax file
" Language: Vim help file
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2024 Dec 25
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
2004-06-13 20:20:40 +00:00
2005-06-21 22:37:39 +00:00
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
2004-06-13 20:20:40 +00:00
finish
endif
2012-01-10 14:55:01 +01:00
let s:cpo_save = &cpo
set cpo&vim
if !exists('g:help_example_languages')
let g:help_example_languages = #{ vim: 'vim' }
endif
2022-11-18 21:49:57 +00:00
syn match helpHeadline "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
2012-07-25 17:49:10 +02:00
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
" silent! to prevent E403
execute 'silent! syn include' $'@helpExampleHighlight_{s:lang}'
\ $'syntax/{s:syntax}.vim'
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
2004-06-13 20:20:40 +00:00
if has("ebcdic")
2006-04-12 21:52:12 +00:00
syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" contains=helpBar
2006-04-13 20:37:35 +00:00
syn match helpHyperTextEntry "\*[^"*|]\+\*\s"he=e-1 contains=helpStar
syn match helpHyperTextEntry "\*[^"*|]\+\*$" contains=helpStar
2004-06-13 20:20:40 +00:00
else
2006-04-12 21:52:12 +00:00
syn match helpHyperTextJump "\\\@<!|[#-)!+-~]\+|" contains=helpBar
2006-04-13 20:37:35 +00:00
syn match helpHyperTextEntry "\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar
syn match helpHyperTextEntry "\*[#-)!+-~]\+\*$" contains=helpStar
2004-06-13 20:20:40 +00:00
endif
if has("conceal")
2013-02-06 17:34:04 +01:00
syn match helpBar contained "|" conceal
syn match helpBacktick contained "`" conceal
syn match helpStar contained "\*" conceal
else
2013-02-06 17:34:04 +01:00
syn match helpBar contained "|"
syn match helpBacktick contained "`"
syn match helpStar contained "\*"
endif
2004-06-13 20:20:40 +00:00
syn match helpNormal "|.*====*|"
2011-12-14 21:17:39 +01:00
syn match helpNormal "|||"
2004-06-13 20:20:40 +00:00
syn match helpNormal ":|vim:|" " for :help modeline
syn match helpVim "\<Vim version [0-9][0-9.a-z]*"
2004-06-13 20:20:40 +00:00
syn match helpVim "VIM REFERENCE.*"
syn match helpOption "'[a-z]\{2,\}'"
syn match helpOption "'t_..'"
2022-09-27 17:30:34 +01:00
syn match helpNormal "'ab'"
2013-09-05 22:13:31 +02:00
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
2004-06-13 20:20:40 +00:00
syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
2010-11-16 20:34:40 +01:00
syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
if has("conceal")
syn match helpIgnore "." contained conceal
else
syn match helpIgnore "." contained
endif
2004-06-13 20:20:40 +00:00
syn keyword helpNote note Note NOTE note: Note: NOTE: Notes Notes:
syn match helpNote "\c(note\(:\|\>\)"ms=s+1
syn keyword helpWarning WARNING WARNING: Warning:
syn keyword helpDeprecated DEPRECATED DEPRECATED: Deprecated:
2004-06-13 20:20:40 +00:00
syn match helpSpecial "\<N\>"
syn match helpSpecial "\<N\.$"me=e-1
syn match helpSpecial "\<N\.\s"me=e-2
syn match helpSpecial "(N\>"ms=s+1
2017-11-02 22:58:42 +01:00
2004-06-13 20:20:40 +00:00
syn match helpSpecial "\[N]"
" avoid highlighting N N in quickref.txt
2004-06-13 20:20:40 +00:00
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
syn match helpSpecial "] -N\>"ms=s+3
syn match helpSpecial "+N\>"ms=s+1
syn match helpSpecial "\[+-]N\>"ms=s+4
" 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
2004-06-13 20:20:40 +00:00
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 "<[SCM]-.>"
syn match helpNormal "<---*>"
syn match helpSpecial "\[range]"
syn match helpSpecial "\[line]"
syn match helpSpecial "\[count]"
syn match helpSpecial "\[offset]"
syn match helpSpecial "\[cmd]"
2021-06-27 15:18:56 +02:00
syn match helpNormal "vim9\[cmd]"
2004-06-13 20:20:40 +00:00
syn match helpSpecial "\[num]"
syn match helpSpecial "\[+num]"
syn match helpSpecial "\[-num]"
syn match helpSpecial "\[+cmd]"
syn match helpSpecial "\[++opt]"
syn match helpSpecial "\[arg]"
syn match helpSpecial "\[arguments]"
syn match helpSpecial "\[ident]"
syn match helpSpecial "\[addr]"
syn match helpSpecial "\[group]"
2017-11-02 22:58:42 +01:00
" Don't highlight [converted] and others that do not have a tag
syn match helpNormal "\[\(readonly\|fifo\|socket\|converted\|crypted\)]"
2004-06-13 20:20:40 +00:00
syn match helpSpecial "CTRL-."
syn match helpSpecial "CTRL-<\a\+>"
2019-11-26 21:44:46 +01:00
syn match helpSpecial "CTRL-SHIFT-."
2004-06-13 20:20:40 +00:00
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 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/]`
2004-06-13 20:20:40 +00:00
syn match helpDiffAdded "\t[* ]Added\t\+[a-z].*"
syn match helpDiffChanged "\t[* ]Changed\t\+[a-z].*"
syn match helpDiffRemoved "\t[* ]Removed\t\+[a-z].*"
2004-06-13 20:20:40 +00:00
" Additionally load a language-specific syntax file "help_ab.vim".
2005-04-15 21:13:42 +00:00
let s:i = match(expand("%"), '\.\a\ax$')
if s:i > 0
exe "runtime syntax/help_" . strpart(expand("%"), s:i + 1, 2) . ".vim"
2004-06-13 20:20:40 +00:00
endif
syn sync minlines=40
" Define the default highlighting.
2005-06-21 22:37:39 +00:00
" Only used when an item doesn't have highlighting yet
hi def link helpIgnore Ignore
2013-11-28 13:53:34 +01:00
hi def link helpHyperTextJump Identifier
2006-04-12 21:52:12 +00:00
hi def link helpBar Ignore
2013-02-06 17:34:04 +01:00
hi def link helpBacktick Ignore
2006-04-13 20:37:35 +00:00
hi def link helpStar Ignore
2005-06-21 22:37:39 +00:00
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
2012-04-25 19:07:41 +02:00
hi def link helpCommand Comment
2005-06-21 22:37:39 +00:00
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
2016-09-06 22:12:34 +02:00
hi def link helpWarning Todo
hi def link helpDeprecated Todo
2004-06-13 20:20:40 +00:00
2005-06-21 22:37:39 +00:00
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 helpError Error
hi def link helpTodo Todo
2005-09-01 20:46:49 +00:00
hi def link helpURL String
hi def link helpDiffAdded Added
hi def link helpDiffChanged Changed
hi def link helpDiffRemoved Removed
2004-06-13 20:20:40 +00:00
2022-05-21 13:08:16 +01:00
if has('textprop') && expand('%:p') =~ '[/\\]doc[/\\]syntax.txt'
2022-05-07 21:54:03 +01:00
" highlight groups with their respective color
import 'dist/vimhelp.vim'
call vimhelp.HighlightGroups()
endif
2004-06-13 20:20:40 +00:00
let b:current_syntax = "help"
2012-01-10 14:55:01 +01:00
let &cpo = s:cpo_save
unlet s:cpo_save
2004-06-13 20:20:40 +00:00
" vim: ts=8 sw=2