runtime(help): Add Vim lang annotation support for codeblocks
closes: #16215
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim
index ae7e3bc..3886164 100644
--- a/runtime/syntax/help.vim
+++ b/runtime/syntax/help.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Vim help file
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2024 Oct 16
+" Last Change: 2024 Dec 15
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Quit when a (custom) syntax file was already loaded
@@ -15,10 +15,22 @@
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
-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=/^</ concealends
+ \ contains=@VimScript keepend
+ 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
endif
if has("ebcdic")
syn match helpHyperTextJump "\\\@<!|[^"*|]\+|" contains=helpBar