aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-02 06:41:10 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-02-02 06:45:06 +0800
commit882d5fa5584f8223a9d405ecd0367c53188162fa (patch)
tree80966bd9804dfe608d0dc1990898f234694dce3d
parent05fd70f19b39519985000141d022971e37d66189 (diff)
downloadrneovim-882d5fa5584f8223a9d405ecd0367c53188162fa.tar.gz
rneovim-882d5fa5584f8223a9d405ecd0367c53188162fa.tar.bz2
rneovim-882d5fa5584f8223a9d405ecd0367c53188162fa.zip
vim-patch:69866449ddb2
runtime(vim): Improve keymap file highlighting (vim/vim#13550) - Match :loadkeymap to EOF as a region and contain only allowed items. - Add highlighting for <Char- notation. - add basic syntax highlighting tests https://github.com/vim/vim/commit/69866449ddb20e329f4bc5250312fbfb4a773986 N/A patches: vim-patch:35928ee8f80ea721e92bb856c8ecde2cced46bb9 vim-patch:b5352931b354eb67eb7d223cc09c98dcf1b547b6 Co-authored-by: dkearns <dougkearns@gmail.com>
-rw-r--r--runtime/syntax/vim.vim18
1 files changed, 17 insertions, 1 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 298215b880..094f9f98aa 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -234,7 +234,20 @@ syn match vimFuncBlank contained "\s\+"
syn keyword vimPattern contained start skip end
" vimTypes : new for vim9
- syn match vimType ":\s*\zs\<\(bool\|number\|float\|string\|blob\|list<\|dict<\|job\|channel\|func\)\>"
+syn match vimType ":\s*\zs\<\(bool\|number\|float\|string\|blob\|list<\|dict<\|job\|channel\|func\)\>"
+
+" Keymaps: (Vim Project Addition) {{{2
+" =======
+
+" TODO: autogenerated vimCommand keyword list does not handle all abbreviations
+" : handle Vim9 script comments when something like #13104 is merged
+syn match vimKeymapStart "^" contained skipwhite nextgroup=vimKeymapLhs,vimKeymapLineComment
+syn match vimKeymapLhs "\S\+" contained skipwhite nextgroup=vimKeymapRhs contains=vimNotation
+syn match vimKeymapRhs "\S\+" contained skipwhite nextgroup=vimKeymapTailComment contains=vimNotation
+syn match vimKeymapTailComment "\S.*" contained
+syn match vimKeymapLineComment +".*+ contained contains=@vimCommentGroup,vimCommentString,vimCommentTitle
+
+syn region vimKeymap matchgroup=vimCommand start="\<loadk\%[eymap]\>" end="\%$" contains=vimKeymapStart
" Special Filenames, Modifiers, Extension Removal: {{{2
" ===============================================
@@ -451,6 +464,7 @@ syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\
syn match vimNotation '\(\\\|<lt>\)\=<C-R>[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket
syn match vimNotation '\%#=1\(\\\|<lt>\)\=<\%(q-\)\=\(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket
syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([cas]file\|abuf\|amatch\|cword\|cWORD\|client\)>" contains=vimBracket
+syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\%([scamd]-\)\{0,4}char-\%(\d\+\|0\o\+\|0x\x\+\)>" contains=vimBracket
syn match vimBracket contained "[\\<>]"
syn case match
@@ -946,6 +960,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vimInsert vimString
hi def link vimIskSep Delimiter
hi def link vimKeyCode vimSpecFile
+ hi def link vimKeymapLineComment vimComment
+ hi def link vimKeymapTailComment vimComment
hi def link vimKeyword Statement
hi def link vimLet vimCommand
hi def link vimLetHereDoc vimString