diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-08-17 07:09:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-16 23:09:39 +0000 |
commit | 172cc23d88585dd7520726c2ebbba4ed7639e348 (patch) | |
tree | df7d16fa64c1b3723870586838783d7c559c8531 /runtime/syntax/vim.vim | |
parent | d698b3acca9632b68e198c7e7ca9b720c960e969 (diff) | |
download | rneovim-172cc23d88585dd7520726c2ebbba4ed7639e348.tar.gz rneovim-172cc23d88585dd7520726c2ebbba4ed7639e348.tar.bz2 rneovim-172cc23d88585dd7520726c2ebbba4ed7639e348.zip |
vim-patch:d164f2a: runtime(vim): Update base-syntax, improve :let-heredoc highlighting (#30069)
The end marker must appear on line of its own without any trailing
whitespace.
Whitespace is incorrectly allowed before all end markers. Limiting this
only to heredocs where "trim" was specified, and with the correct
indent, is currently an intractable problem given that contained syntax
groups (in this case :let) cannot be limited to start patterns.
Highlight interpolated expressions when "eval" is specified.
cloess: vim/vim#15511
https://github.com/vim/vim/commit/d164f2a521f8e52e587727657fb1c19e9a25f32a
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat (limited to 'runtime/syntax/vim.vim')
-rw-r--r-- | runtime/syntax/vim.vim | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 8dd72d76e5..57516dfa61 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -433,11 +433,12 @@ syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1 syn match vimEscape contained "\\<" contains=vimNotation syn match vimEscape contained "\\<\*[^>]*>\=>" -syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=vimStringInterpolationBrace,vimStringInterpolationExpr -syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=@vimStringInterpolation +syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,@vimStringInterpolation syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList syn match vimStringInterpolationBrace contained "{{" syn match vimStringInterpolationBrace contained "}}" +syn cluster vimStringInterpolation contains=vimStringInterpolationExpr,vimStringInterpolationBrace " Substitutions: {{{2 " ============= @@ -517,7 +518,13 @@ VimL syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber -VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' extend +" Note: This incorrectly matches end markers with leading whitespace even if +" "trim" was not specified. Matching :let indent for "trim" indented +" end markers would require a contained :let that cannot be restricted +" to the start pattern. A common internal testing use of heredocs is to +" specify code blocks where :let commonly appears in the heredoc text. +VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' extend +VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(\%(trim\s\+\)\=eval\s\+\|eval\s\+\%(trim\s\+\)\=\)\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1$' contains=@vimStringInterpolation extend Vim9 syn keyword vim9Const const skipwhite nextgroup=vim9Variable,vim9VariableList Vim9 syn keyword vim9Final final skipwhite nextgroup=vim9Variable,vim9VariableList |