mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
runtime(help): Add better support for language annotation highlighting
closes: #16238 Co-authored-by: Christian Brabandt <cb@256bit.org> Co-authored-by: h_east <h.east.727@gmail.com> Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
9360de9027
commit
5ddcecf05f
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: Vim help file
|
||||
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
" Last Change: 2024 Dec 15
|
||||
" Last Change: 2024 Dec 25
|
||||
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
@@ -12,26 +12,36 @@ endif
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:help_example_languages')
|
||||
let g:help_example_languages = #{ vim: 'vim' }
|
||||
endif
|
||||
|
||||
syn match helpHeadline "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
|
||||
syn match helpSectionDelim "^===.*===$"
|
||||
syn match helpSectionDelim "^---.*--$"
|
||||
|
||||
unlet! b:current_syntax
|
||||
" sil! to prevent E403
|
||||
silent! syntax include @VimScript syntax/vim.vim
|
||||
if has("conceal")
|
||||
syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<" concealends
|
||||
syn region helpExampleVimScript matchgroup=helpIgnore
|
||||
\ start=/^>vim$/ start=/ >vim$/
|
||||
\ end=/^[^ \t]/me=e-1 end=/^</ concealends
|
||||
\ contains=@VimScript keepend
|
||||
syn region helpExample matchgroup=helpIgnore
|
||||
\ start="\%(^\| \)>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" concealends
|
||||
else
|
||||
syn region helpExample matchgroup=helpIgnore start=" >$" start="^>$" end="^[^ \t]"me=e-1 end="^<"
|
||||
syn region helpExampleVimScript matchgroup=helpIgnore
|
||||
\ start=/^>vim$/ start=/ >vim$/
|
||||
\ end=/^[^ \t]/me=e-1 end=/^</
|
||||
\ contains=@VimScript keepend
|
||||
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
|
||||
|
||||
if has("ebcdic")
|
||||
syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" contains=helpBar
|
||||
syn match helpHyperTextEntry "\*[^"*|]\+\*\s"he=e-1 contains=helpStar
|
||||
|
Reference in New Issue
Block a user