mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:6fea0a5: runtime(help): Add Vim lang annotation support for codeblocks
closes: vim/vim#162156fea0a5480Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> (cherry picked from commit11ae879ebd)
This commit is contained in:
		 brianhuster
					brianhuster
				
			
				
					committed by
					
						![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
						parent
						
							ced4eed733
						
					
				
				
					commit
					35a66f74c7
				
			| @@ -377,7 +377,13 @@ also implicitly stops the block of ex-commands before it.  E.g. > | |||||||
| 	echo "Example" | 	echo "Example" | ||||||
|     endfunction |     endfunction | ||||||
| < | < | ||||||
|  | It's possible to add Vim syntax highlighting support to code examples.  This | ||||||
|  | can be done by adding "vim" after the greater than (>) character (">vim"). | ||||||
|  | E.g: >vim | ||||||
|  |     function Example_Func() | ||||||
|  | 	echo "Example" | ||||||
|  |     endfunction | ||||||
|  | < | ||||||
| The following are highlighted differently in a Vim help file: | The following are highlighted differently in a Vim help file: | ||||||
|   - a special key name expressed either in <> notation as in <PageDown>, or |   - a special key name expressed either in <> notation as in <PageDown>, or | ||||||
|     as a Ctrl character as in CTRL-X |     as a Ctrl character as in CTRL-X | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| " Vim syntax file | " Vim syntax file | ||||||
| " Language:	Vim help file | " Language:	Vim help file | ||||||
| " Maintainer:	The Vim Project <https://github.com/vim/vim> | " 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> | " Former Maintainer:	Bram Moolenaar <Bram@vim.org> | ||||||
|  |  | ||||||
| " Quit when a (custom) syntax file was already loaded | " Quit when a (custom) syntax file was already loaded | ||||||
| @@ -15,11 +15,24 @@ set cpo&vim | |||||||
| syn match helpHeadline		"^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)" | syn match helpHeadline		"^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)" | ||||||
| syn match helpSectionDelim	"^===.*===$" | syn match helpSectionDelim	"^===.*===$" | ||||||
| syn match helpSectionDelim	"^---.*--$" | syn match helpSectionDelim	"^---.*--$" | ||||||
|  |  | ||||||
|  | unlet! b:current_syntax | ||||||
|  | " sil! to prevent E403 | ||||||
|  | silent! syntax include @VimScript syntax/vim.vim | ||||||
|  |  | ||||||
| " Nvim: support language annotation in codeblocks | " Nvim: support language annotation in codeblocks | ||||||
| if has("conceal") | if has("conceal") | ||||||
|   syn region helpExample	matchgroup=helpIgnore start=" >[a-z0-9]*$" start="^>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" concealends |   syn region helpExample	matchgroup=helpIgnore start=" >[a-z0-9]*$" start="^>[a-z0-9]*$" 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 | ||||||
| else | else | ||||||
|   syn region helpExample	matchgroup=helpIgnore start=" >[a-z0-9]*$" start="^>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" |   syn region helpExample	matchgroup=helpIgnore start=" >[a-z0-9]*$" start="^>[a-z0-9]*$" 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 | endif | ||||||
| syn match helpHyperTextJump	"\\\@<!|[#-)!+-~]\+|" contains=helpBar | syn match helpHyperTextJump	"\\\@<!|[#-)!+-~]\+|" contains=helpBar | ||||||
| syn match helpHyperTextEntry	"\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar | syn match helpHyperTextEntry	"\*[#-)!+-~]\+\*\s"he=e-1 contains=helpStar | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user