mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
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: #14530 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
parent
5a9f7e6750
commit
ce06493aeb
@ -1,4 +1,4 @@
|
|||||||
*syntax.txt* For Vim version 9.1. Last change: 2024 Apr 09
|
*syntax.txt* For Vim version 9.1. Last change: 2024 Apr 13
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -3764,12 +3764,15 @@ Some folding is now supported with syntax/vim.vim: >
|
|||||||
g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
|
g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
|
||||||
g:vimsyn_folding =~ 'a' : augroups
|
g:vimsyn_folding =~ 'a' : augroups
|
||||||
g:vimsyn_folding =~ 'f' : fold functions
|
g:vimsyn_folding =~ 'f' : fold functions
|
||||||
|
g:vimsyn_folding =~ 'h' : fold heredocs
|
||||||
|
g:vimsyn_folding =~ 'H' : fold Vim9-script legacy headers
|
||||||
g:vimsyn_folding =~ 'l' : fold lua script
|
g:vimsyn_folding =~ 'l' : fold lua script
|
||||||
g:vimsyn_folding =~ 'm' : fold mzscheme script
|
g:vimsyn_folding =~ 'm' : fold mzscheme script
|
||||||
g:vimsyn_folding =~ 'p' : fold perl script
|
g:vimsyn_folding =~ 'p' : fold perl script
|
||||||
g:vimsyn_folding =~ 'P' : fold python script
|
g:vimsyn_folding =~ 'P' : fold python script
|
||||||
g:vimsyn_folding =~ 'r' : fold ruby script
|
g:vimsyn_folding =~ 'r' : fold ruby script
|
||||||
g:vimsyn_folding =~ 't' : fold tcl script
|
g:vimsyn_folding =~ 't' : fold tcl script
|
||||||
|
let g:vimsyn_folding = 'acfhlmpPrt'
|
||||||
<
|
<
|
||||||
*g:vimsyn_noerror*
|
*g:vimsyn_noerror*
|
||||||
Not all error highlighting that syntax/vim.vim does may be correct; Vim script
|
Not all error highlighting that syntax/vim.vim does may be correct; Vim script
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||||
" Doug Kearns <dougkearns@gmail.com>
|
" Doug Kearns <dougkearns@gmail.com>
|
||||||
" URL: https://github.com/vim-jp/syntax-vim-ex
|
" URL: https://github.com/vim-jp/syntax-vim-ex
|
||||||
" Last Change: 2024 Apr 09
|
" Last Change: 2024 Apr 12
|
||||||
" Former Maintainer: Charles E. Campbell
|
" Former Maintainer: Charles E. Campbell
|
||||||
|
|
||||||
" DO NOT CHANGE DIRECTLY.
|
" DO NOT CHANGE DIRECTLY.
|
||||||
@ -79,7 +79,7 @@ syn case match
|
|||||||
" Special Vim Highlighting (not automatic) {{{1
|
" Special Vim Highlighting (not automatic) {{{1
|
||||||
|
|
||||||
" Set up folding commands for this syntax highlighting file {{{2
|
" 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'
|
if g:vimsyn_folding =~# 'a'
|
||||||
com! -nargs=* VimFolda <args> fold
|
com! -nargs=* VimFolda <args> fold
|
||||||
else
|
else
|
||||||
@ -95,6 +95,11 @@ if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhlmpPrt]'
|
|||||||
else
|
else
|
||||||
com! -nargs=* VimFoldh <args>
|
com! -nargs=* VimFoldh <args>
|
||||||
endif
|
endif
|
||||||
|
if g:vimsyn_folding =~# 'H'
|
||||||
|
com! -nargs=* VimFoldH <args> fold
|
||||||
|
else
|
||||||
|
com! -nargs=* VimFoldH <args>
|
||||||
|
endif
|
||||||
if g:vimsyn_folding =~# 'l'
|
if g:vimsyn_folding =~# 'l'
|
||||||
com! -nargs=* VimFoldl <args> fold
|
com! -nargs=* VimFoldl <args> fold
|
||||||
else
|
else
|
||||||
@ -129,6 +134,7 @@ else
|
|||||||
com! -nargs=* VimFolda <args>
|
com! -nargs=* VimFolda <args>
|
||||||
com! -nargs=* VimFoldf <args>
|
com! -nargs=* VimFoldf <args>
|
||||||
com! -nargs=* VimFoldh <args>
|
com! -nargs=* VimFoldh <args>
|
||||||
|
com! -nargs=* VimFoldH <args>
|
||||||
com! -nargs=* VimFoldl <args>
|
com! -nargs=* VimFoldl <args>
|
||||||
com! -nargs=* VimFoldm <args>
|
com! -nargs=* VimFoldm <args>
|
||||||
com! -nargs=* VimFoldp <args>
|
com! -nargs=* VimFoldp <args>
|
||||||
@ -827,11 +833,11 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e
|
|||||||
" ==================
|
" ==================
|
||||||
|
|
||||||
if s:vim9script
|
if s:vim9script
|
||||||
syn cluster vimLegacyTop contains=TOP,vimPreVim9script,vim9Comment,vim9LineComment
|
syn cluster vimLegacyTop contains=TOP,vim9LegacyHeader,vim9Comment,vim9LineComment
|
||||||
syn region vimPreVim9script start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment
|
VimFoldH syn region vim9LegacyHeader start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment
|
||||||
|
|
||||||
syn keyword vim9ScriptArg noclear
|
syn keyword vim9Vim9ScriptArg noclear contained
|
||||||
syn keyword vimCommand vim9s[cript] nextgroup=vim9ScriptArg skipwhite
|
syn keyword vim9Vim9Script vim9s[cript] nextgroup=vim9Vim9ScriptArg skipwhite
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Embedded Scripts: {{{2
|
" Embedded Scripts: {{{2
|
||||||
@ -1041,7 +1047,7 @@ if !exists("skip_vim_syntax_inits")
|
|||||||
hi def link vimBufnrWarn vimWarn
|
hi def link vimBufnrWarn vimWarn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
hi def link vim9ScriptArg Special
|
hi def link vim9Vim9ScriptArg Special
|
||||||
hi def link vimAbb vimCommand
|
hi def link vimAbb vimCommand
|
||||||
hi def link vimAddress vimMark
|
hi def link vimAddress vimMark
|
||||||
hi def link vimAugroupBang vimBang
|
hi def link vimAugroupBang vimBang
|
||||||
@ -1171,6 +1177,7 @@ if !exists("skip_vim_syntax_inits")
|
|||||||
hi def link vimSetMod vimOption
|
hi def link vimSetMod vimOption
|
||||||
hi def link vimSetSep Statement
|
hi def link vimSetSep Statement
|
||||||
hi def link vimSetString vimString
|
hi def link vimSetString vimString
|
||||||
|
hi def link vim9Vim9Script vimCommand
|
||||||
hi def link vimSpecFile Identifier
|
hi def link vimSpecFile Identifier
|
||||||
hi def link vimSpecFileMod vimSpecFile
|
hi def link vimSpecFileMod vimSpecFile
|
||||||
hi def link vimSpecial Type
|
hi def link vimSpecial Type
|
||||||
@ -1235,6 +1242,8 @@ let b:current_syntax = "vim"
|
|||||||
" Cleanup: {{{1
|
" Cleanup: {{{1
|
||||||
delc VimFolda
|
delc VimFolda
|
||||||
delc VimFoldf
|
delc VimFoldf
|
||||||
|
delc VimFoldh
|
||||||
|
delc VimFoldH
|
||||||
delc VimFoldl
|
delc VimFoldl
|
||||||
delc VimFoldm
|
delc VimFoldm
|
||||||
delc VimFoldp
|
delc VimFoldp
|
||||||
|
20
runtime/syntax/testdir/dumps/vim9_legacy_header_fold_00.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_legacy_header_fold_00.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
>++0#0000e05#a8a8a8255|-@1| |1@1| |l|i|n|e|s|:| |"| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"|H|"| ||| |s|e|t| |f|d|m|=|s|y|n|t|a|x|-
|
||||||
|
|v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&|n+0#e000e06&|o|c|l|e|a|r| +0#0000000&@56
|
||||||
|
@75
|
||||||
|
|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@65
|
||||||
|
@75
|
||||||
|
| +0#0000e05&|#| |s|t|r|i|n|g| |o|n|l|y| |r|e|c|o|g|n|i|s|e|d| |w|i|t|h| |l|e|a|d|i|n|g| |c|h|a|r| +0#0000000&@31
|
||||||
|
@1|"+0#e000002&|u|s|e|l|e|s@1| |s|t|r|i|n|g|"| +0#0000000&@57
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
| +0#0000000&@56|1|,|1| @10|A|l@1|
|
20
runtime/syntax/testdir/dumps/vim9_legacy_header_fold_99.dump
Normal file
20
runtime/syntax/testdir/dumps/vim9_legacy_header_fold_99.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|++0#0000e05#a8a8a8255|-@1| |1@1| |l|i|n|e|s|:| |"| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"|H|"| ||| |s|e|t| |f|d|m|=|s|y|n|t|a|x|-
|
||||||
|
|v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&|n+0#e000e06&|o|c|l|e|a|r| +0#0000000&@56
|
||||||
|
@75
|
||||||
|
|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@65
|
||||||
|
@75
|
||||||
|
| +0#0000e05&|#| |s|t|r|i|n|g| |o|n|l|y| |r|e|c|o|g|n|i|s|e|d| |w|i|t|h| |l|e|a|d|i|n|g| |c|h|a|r| +0#0000000&@31
|
||||||
|
@1>"+0#e000002&|u|s|e|l|e|s@1| |s|t|r|i|n|g|"| +0#0000000&@57
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
| +0#0000000&@56|1|7|,|2| @9|A|l@1|
|
17
runtime/syntax/testdir/input/vim9_legacy_header_fold.vim
Normal file
17
runtime/syntax/testdir/input/vim9_legacy_header_fold.vim
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
" VIM_TEST_SETUP let g:vimsyn_folding = "H" | set fdm=syntax
|
||||||
|
" comment
|
||||||
|
|
||||||
|
if !has('vim9script')
|
||||||
|
# 42 " comment
|
||||||
|
source foo.vim
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" comment
|
||||||
|
|
||||||
|
vim9script noclear
|
||||||
|
|
||||||
|
# comment
|
||||||
|
|
||||||
|
# string only recognised with leading char
|
||||||
|
"useless string"
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
|
||||||
" Doug Kearns <dougkearns@gmail.com>
|
" Doug Kearns <dougkearns@gmail.com>
|
||||||
" URL: https://github.com/vim-jp/syntax-vim-ex
|
" URL: https://github.com/vim-jp/syntax-vim-ex
|
||||||
" Last Change: 2024 Apr 11
|
" Last Change: 2024 Apr 13
|
||||||
" Former Maintainer: Charles E. Campbell
|
" Former Maintainer: Charles E. Campbell
|
||||||
|
|
||||||
" DO NOT CHANGE DIRECTLY.
|
" DO NOT CHANGE DIRECTLY.
|
||||||
@ -116,7 +116,7 @@ syn keyword vimFuncName contained test_mswin_event test_null_blob test_null_chan
|
|||||||
" Special Vim Highlighting (not automatic) {{{1
|
" Special Vim Highlighting (not automatic) {{{1
|
||||||
|
|
||||||
" Set up folding commands for this syntax highlighting file {{{2
|
" 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'
|
if g:vimsyn_folding =~# 'a'
|
||||||
com! -nargs=* VimFolda <args> fold
|
com! -nargs=* VimFolda <args> fold
|
||||||
else
|
else
|
||||||
@ -132,6 +132,11 @@ if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhlmpPrt]'
|
|||||||
else
|
else
|
||||||
com! -nargs=* VimFoldh <args>
|
com! -nargs=* VimFoldh <args>
|
||||||
endif
|
endif
|
||||||
|
if g:vimsyn_folding =~# 'H'
|
||||||
|
com! -nargs=* VimFoldH <args> fold
|
||||||
|
else
|
||||||
|
com! -nargs=* VimFoldH <args>
|
||||||
|
endif
|
||||||
if g:vimsyn_folding =~# 'l'
|
if g:vimsyn_folding =~# 'l'
|
||||||
com! -nargs=* VimFoldl <args> fold
|
com! -nargs=* VimFoldl <args> fold
|
||||||
else
|
else
|
||||||
@ -166,6 +171,7 @@ else
|
|||||||
com! -nargs=* VimFolda <args>
|
com! -nargs=* VimFolda <args>
|
||||||
com! -nargs=* VimFoldf <args>
|
com! -nargs=* VimFoldf <args>
|
||||||
com! -nargs=* VimFoldh <args>
|
com! -nargs=* VimFoldh <args>
|
||||||
|
com! -nargs=* VimFoldH <args>
|
||||||
com! -nargs=* VimFoldl <args>
|
com! -nargs=* VimFoldl <args>
|
||||||
com! -nargs=* VimFoldm <args>
|
com! -nargs=* VimFoldm <args>
|
||||||
com! -nargs=* VimFoldp <args>
|
com! -nargs=* VimFoldp <args>
|
||||||
@ -871,11 +877,11 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e
|
|||||||
" ==================
|
" ==================
|
||||||
|
|
||||||
if s:vim9script
|
if s:vim9script
|
||||||
syn cluster vimLegacyTop contains=TOP,vimPreVim9script,vim9Comment,vim9LineComment
|
syn cluster vimLegacyTop contains=TOP,vim9LegacyHeader,vim9Comment,vim9LineComment
|
||||||
syn region vimPreVim9script start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment
|
VimFoldH syn region vim9LegacyHeader start="\%^" end="^\ze\s*vim9s\%[cript]\>" contains=@vimLegacyTop,vimComment,vimLineComment
|
||||||
|
|
||||||
syn keyword vim9ScriptArg noclear
|
syn keyword vim9Vim9ScriptArg noclear contained
|
||||||
syn keyword vimCommand vim9s[cript] nextgroup=vim9ScriptArg skipwhite
|
syn keyword vim9Vim9Script vim9s[cript] nextgroup=vim9Vim9ScriptArg skipwhite
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Embedded Scripts: {{{2
|
" Embedded Scripts: {{{2
|
||||||
@ -1085,7 +1091,7 @@ if !exists("skip_vim_syntax_inits")
|
|||||||
hi def link vimBufnrWarn vimWarn
|
hi def link vimBufnrWarn vimWarn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
hi def link vim9ScriptArg Special
|
hi def link vim9Vim9ScriptArg Special
|
||||||
hi def link vimAbb vimCommand
|
hi def link vimAbb vimCommand
|
||||||
hi def link vimAddress vimMark
|
hi def link vimAddress vimMark
|
||||||
hi def link vimAugroupBang vimBang
|
hi def link vimAugroupBang vimBang
|
||||||
@ -1215,6 +1221,7 @@ if !exists("skip_vim_syntax_inits")
|
|||||||
hi def link vimSetMod vimOption
|
hi def link vimSetMod vimOption
|
||||||
hi def link vimSetSep Statement
|
hi def link vimSetSep Statement
|
||||||
hi def link vimSetString vimString
|
hi def link vimSetString vimString
|
||||||
|
hi def link vim9Vim9Script vimCommand
|
||||||
hi def link vimSpecFile Identifier
|
hi def link vimSpecFile Identifier
|
||||||
hi def link vimSpecFileMod vimSpecFile
|
hi def link vimSpecFileMod vimSpecFile
|
||||||
hi def link vimSpecial Type
|
hi def link vimSpecial Type
|
||||||
@ -1279,6 +1286,8 @@ let b:current_syntax = "vim"
|
|||||||
" Cleanup: {{{1
|
" Cleanup: {{{1
|
||||||
delc VimFolda
|
delc VimFolda
|
||||||
delc VimFoldf
|
delc VimFoldf
|
||||||
|
delc VimFoldh
|
||||||
|
delc VimFoldH
|
||||||
delc VimFoldl
|
delc VimFoldl
|
||||||
delc VimFoldm
|
delc VimFoldm
|
||||||
delc VimFoldp
|
delc VimFoldp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user