diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-14 07:35:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-14 07:35:08 +0800 |
commit | a92822835521574710a830a7de0e692bf7517fb8 (patch) | |
tree | ea215aa28438c80aa33a394b8db37c945ed05b92 /runtime/syntax/vim.vim | |
parent | 7e9eade7eaabd2b16a71b0ecc39b0ae0776b1e07 (diff) | |
download | rneovim-a92822835521574710a830a7de0e692bf7517fb8.tar.gz rneovim-a92822835521574710a830a7de0e692bf7517fb8.tar.bz2 rneovim-a92822835521574710a830a7de0e692bf7517fb8.zip |
vim-patch:ce06493aeb3d (#28321)
runtime(vim): Update base-syntax, add legacy header folding
Allow for syntax-based folding of Vim9 script legacy header regions.
This is enabled with the "H" flag of the g:vimsyn_folding config variable.
closes: vim/vim#14530
https://github.com/vim/vim/commit/ce06493aeb3d198d13de289ac39d1ed0f1604429
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat (limited to 'runtime/syntax/vim.vim')
-rw-r--r-- | runtime/syntax/vim.vim | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 4de9cb1425..75292b0445 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -69,7 +69,7 @@ syn case match " Special Vim Highlighting (not automatic) {{{1 " Set up folding commands for this syntax highlighting file {{{2 -if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhlmpPrt]' +if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhHlmpPrt]' if g:vimsyn_folding =~# 'a' com! -nargs=* VimFolda <args> fold else @@ -85,6 +85,11 @@ if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhlmpPrt]' else com! -nargs=* VimFoldh <args> endif + if g:vimsyn_folding =~# 'H' + com! -nargs=* VimFoldH <args> fold + else + com! -nargs=* VimFoldH <args> + endif if g:vimsyn_folding =~# 'l' com! -nargs=* VimFoldl <args> fold else @@ -119,6 +124,7 @@ else com! -nargs=* VimFolda <args> com! -nargs=* VimFoldf <args> com! -nargs=* VimFoldh <args> + com! -nargs=* VimFoldH <args> com! -nargs=* VimFoldl <args> com! -nargs=* VimFoldm <args> com! -nargs=* VimFoldp <args> @@ -820,11 +826,11 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e " ================== if s:vim9script - syn cluster vimLegacyTop contains=TOP,vimPreVim9script,vim9Comment,vim9LineComment - syn region vimPreVim9script start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment + syn cluster vimLegacyTop contains=TOP,vim9LegacyHeader,vim9Comment,vim9LineComment + VimFoldH syn region vim9LegacyHeader start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment - syn keyword vim9ScriptArg noclear - syn keyword vimCommand vim9s[cript] nextgroup=vim9ScriptArg skipwhite + syn keyword vim9Vim9ScriptArg noclear contained + syn keyword vim9Vim9Script vim9s[cript] nextgroup=vim9Vim9ScriptArg skipwhite endif " Embedded Scripts: {{{2 @@ -1038,7 +1044,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimBufnrWarn vimWarn endif - hi def link vim9ScriptArg Special + hi def link vim9Vim9ScriptArg Special hi def link vimAbb vimCommand hi def link vimAddress vimMark hi def link vimAugroupBang vimBang @@ -1168,6 +1174,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimSetMod vimOption hi def link vimSetSep Statement hi def link vimSetString vimString + hi def link vim9Vim9Script vimCommand hi def link vimSpecFile Identifier hi def link vimSpecFileMod vimSpecFile hi def link vimSpecial Type @@ -1235,6 +1242,8 @@ let b:current_syntax = "vim" " Cleanup: {{{1 delc VimFolda delc VimFoldf +delc VimFoldh +delc VimFoldH delc VimFoldl delc VimFoldm delc VimFoldp |