aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/vim.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-10 10:21:34 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-03-10 10:39:43 +0800
commitb5f870cf12c768984536cda2fd6b1519045b8c78 (patch)
treefac23d53501311e88522e8dfe3d4e218f925ac13 /runtime/syntax/vim.vim
parent84b6ae82c728403480cfb5b876643c7fe1c08515 (diff)
downloadrneovim-b5f870cf12c768984536cda2fd6b1519045b8c78.tar.gz
rneovim-b5f870cf12c768984536cda2fd6b1519045b8c78.tar.bz2
rneovim-b5f870cf12c768984536cda2fd6b1519045b8c78.zip
vim-patch:5d67aef3060d
runtime(vim): Update base-syntax, improve :map highlighting (vim/vim#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 vim/vim#12672. https://github.com/vim/vim/commit/5d67aef3060d6d3aa14d273c39f23d8a90c4cef1 Co-authored-by: dkearns <dougkearns@gmail.com>
Diffstat (limited to 'runtime/syntax/vim.vim')
-rw-r--r--runtime/syntax/vim.vim12
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 77e9735b78..6d535c5e7e 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -457,11 +457,13 @@ syn keyword vimMap cmapc[lear] imapc[lear] lmapc[lear] nmapc[lear] omapc[lear] s
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 keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] unm[ap] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
-syn match vimMapLhs contained "\S\+" contains=vimNotation,vimCtrlChar skipwhite nextgroup=vimMapRhs
-syn match vimMapBang contained "\a\@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 "\a\@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs
syn match vimMapMod contained "\%#=1\c<\(buffer\|expr\|\(local\)\=leader\|nowait\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs
-syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend
-syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue
+syn region vimMapRhs contained start="\S" skip=+\\|\|\@1<=|\|\n\s*\\\|\n\s*"\\ + end="|" end="$" contains=@vimContinue,vimCtrlChar,vimNotation skipnl nextgroup=vimMapRhsContinue
+" assume a continuation comment introduces the RHS
+syn region vimMapRhsContinue contained start=+^\s*\%(\\\|"\\ \)+ skip=+\\|\|\@1<=|\|\n\s*\\\|\n\s*"\\ + end="|" end="$" contains=@vimContinue,vimCtrlChar,vimNotation
syn case ignore
syn keyword vimMapModKey contained buffer expr leader localleader nowait plug script sid silent unique
syn case match
@@ -1134,4 +1136,4 @@ delc VimFoldr
delc VimFoldt
let &cpo = s:keepcpo
unlet s:keepcpo
-" vim:ts=18 fdm=marker
+" vim:ts=18 fdm=marker ft=vim