Problem: Vim Syntax Script can be improved
Solution: Rework syntax script, update syntax tests and unit tests
(Doug Kearns).
- Contain Ex commands to valid syntactic contexts.
- Add full address (:range) matching.
- Match :Next, :Print, :X, :global, :&, :~, :>, :<, :# and := commands.
- Match text input commands with folding.
Use :syn-keyword to match all commands except when immediately following
\w range characters where :syn-match is employed.
fixes: #20250 (variables with s_ prefix are wrongly highlighted)
fixes: #17543 (do not highlight vim commands within :runtime)
fixes: #16937 (do not highlight vim commands after packadd)
fixes: #14895 (incorrect highlighting of Vim syntax)
fixes: #14020 (insert commands)
closes: #19331
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
91 lines
1.2 KiB
VimL
91 lines
1.2 KiB
VimL
" Vim comments
|
|
|
|
|
|
" Legacy-script comment
|
|
|
|
# 42 " comment
|
|
|
|
function! Foo()
|
|
" Legacy-script comment
|
|
# 42 " comment
|
|
endfunction
|
|
|
|
def! Bar()
|
|
# Vim9-script comment
|
|
"useless string" # comment
|
|
enddef
|
|
|
|
command -nargs=1 FooCommand {
|
|
# Vim9-script comment
|
|
"useless string" # comment
|
|
}
|
|
|
|
autocmd BufNewFile * {
|
|
# Vim9-script comment
|
|
"useless string" # comment
|
|
}
|
|
|
|
|
|
" Multiline comments
|
|
|
|
" comment
|
|
\ continuing comment
|
|
\ continuing comment
|
|
|
|
let foo = 42 " commment
|
|
\ continuing comment
|
|
\ continuing comment
|
|
|
|
" :Foo
|
|
\ arg1
|
|
"\ comment
|
|
\ arg2
|
|
|
|
echo "TOP"
|
|
|
|
|
|
" Line-continuation comments
|
|
|
|
:Foo
|
|
"\ line continuation comment
|
|
\ arg1
|
|
"\ line continuation comment
|
|
\ arg2
|
|
|
|
|
|
|
|
:"comment"
|
|
: "comment"
|
|
:"comment
|
|
: "comment
|
|
|
|
|
|
" Issue: #13047
|
|
|
|
if !exists(":DiffOrig")
|
|
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
|
|
\ | wincmd p | diffthis
|
|
endif
|
|
|
|
|
|
" Issue: #11307 and #11560
|
|
|
|
" This is what we call " blah
|
|
|
|
|
|
" Issue # #9587
|
|
|
|
def CommentTitle()
|
|
# Title: ...
|
|
enddef
|
|
|
|
|
|
" PR: #19390
|
|
" https://github.com/vim/vim/pull/19390#issue-3933755846
|
|
|
|
def CommentTitle2()
|
|
# E1234: should not have vim9CommentTitle on 'E1234:'
|
|
# ERR34: should have vim9CommentTitle on 'ERR34:'
|
|
enddef
|
|
|