mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
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
ce06493aeb
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
@@ -3271,7 +3271,7 @@ The g:vimsyn_embed option allows users to select what, if any, types of
|
||||
embedded script highlighting they wish to have. >
|
||||
|
||||
g:vimsyn_embed == 0 : disable (don't embed any scripts)
|
||||
g:vimsyn_embed == 'lPr' : support embedded lua, python and ruby
|
||||
g:vimsyn_embed == 'lpPr' : support embedded lua, perl, python and ruby
|
||||
<
|
||||
This option is disabled by default.
|
||||
*g:vimsyn_folding*
|
||||
@@ -3281,7 +3281,11 @@ Some folding is now supported with syntax/vim.vim: >
|
||||
g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
|
||||
g:vimsyn_folding =~ 'a' : augroups
|
||||
g:vimsyn_folding =~ 'f' : fold functions
|
||||
g:vimsyn_folding =~ 'h' : fold heredocs
|
||||
g:vimsyn_folding =~ 'l' : fold lua script
|
||||
g:vimsyn_folding =~ 'p' : fold perl script
|
||||
g:vimsyn_folding =~ 'P' : fold python script
|
||||
g:vimsyn_folding =~ 'r' : fold ruby script
|
||||
<
|
||||
*g:vimsyn_noerror*
|
||||
Not all error highlighting that syntax/vim.vim does may be correct; Vim script
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user