Commit: runtime(vim): Update base-syntax, improve :map highlighting (#14141)

2 views
Skip to first unread message

Christian Brabandt

unread,
Mar 9, 2024, 12:15:10 PM3/9/24
to vim...@googlegroups.com
runtime(vim): Update base-syntax, improve :map highlighting (#14141)

Commit: https://github.com/vim/vim/commit/5d67aef3060d6d3aa14d273c39f23d8a90c4cef1
Author: dkearns <dougk...@gmail.com>
Date: Sun Mar 10 04:01:22 2024 +1100

runtime(vim): Update base-syntax, improve :map highlighting (https://github.com/vim/vim/issues/14141)

Improve :map command highlighting.

- Fix multiline RHS matching, allow continued lines and comments.
- Allow ^V-escaped whitespace in LHS.
- Handle map-bar properly and allow trailing commands.

Fixes issue #12672.


Signed-off-by: Doug Kearns <dougk...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 5fc0d089e..fe8711990 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -467,11 +467,13 @@ syn match vimMap "\<map!" contains=vimMapBang skipwhite nextgroup=vimMapMod,v
" GEN_SYN_VIM: vimCommand mapclear, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod'
syn keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod
" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs'
-syn match vimMapLhs contained "\S\+" contains=vimNotation,vimCtrlChar skipwhite nextgroup=vimMapRhs
-syn match vimMapBang contained " \@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs
+syn match vimMapLhs contained "\%( .\|\S\)\+" contains=vimCtrlChar,vimNotation skipwhite nextgroup=vimMapRhs
+syn match vimMapLhs contained "\%( .\|\S\)\+\ze\s*$" contains=vimCtrlChar,vimNotation skipwhite skipnl nextgroup=vimMapRhsContinue
+syn match vimMapBang contained " \@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs
syn match vimMapMod contained "\%#=1
Reply all
Reply to author
Forward
0 new messages