aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-15 21:28:23 +0800
committerGitHub <noreply@github.com>2024-06-15 21:28:23 +0800
commitbb487ea12e279bb7ab599d55eb027f1c34e4ecbe (patch)
tree24adf519abe371fd0a884cc35a6a430b54ba8bad
parent4faad4a950c68689166f0d6ecf5694cb04a9b589 (diff)
downloadrneovim-bb487ea12e279bb7ab599d55eb027f1c34e4ecbe.tar.gz
rneovim-bb487ea12e279bb7ab599d55eb027f1c34e4ecbe.tar.bz2
rneovim-bb487ea12e279bb7ab599d55eb027f1c34e4ecbe.zip
vim-patch:ae321b5: runtime(vim): Update base-syntax, match shebang lines (vim/vim#15011) (#29351)
Match shebang lines in Vim9 and legacy script. Mark these as an error if they appear anywhere other than the first line of a legacy-script file. In Vim9 script these match as normal line comments rather than an error. https://github.com/vim/vim/commit/ae321b51f7531b23545d64c3a98ed991a31dd5ee Co-authored-by: dkearns <dougkearns@gmail.com>
-rw-r--r--runtime/syntax/vim.vim8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index de2b4ef223..a3b0117e9d 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -828,6 +828,12 @@ endif
syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup
+" allowed anywhere in the file
+if !s:vim9script
+ syn match vimShebangError "^\s*\zs#!.*" display
+endif
+syn match vimShebang "\%^#!.*" display
+
syn match vimContinue "^\s*\zs\\"
syn match vimContinueComment '^\s*\zs["#]\\ .*'
syn cluster vimContinue contains=vimContinue,vimContinueComment
@@ -1058,6 +1064,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimHiCtermError vimError
hi def link vimHiKeyError vimError
hi def link vimMapModErr vimError
+ hi def link vimShebangError vimError
hi def link vimSubstFlagErr vimError
hi def link vimSynCaseError vimError
hi def link vimSynFoldMethodError vimError
@@ -1196,6 +1203,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSetSep Statement
hi def link vimSetString vimString
hi def link vim9Vim9Script vimCommand
+ hi def link vimShebang PreProc
hi def link vimSleep vimCommand
hi def link vimSleepArg Constant
hi def link vimSleepBang vimBang