mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
runtime(vim): Update base-syntax, match continued strings and tail comments
Continued strings are currently only matched after operators, in parenthesised expressions and in function call argument lists. closes: #14975 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
c5cb6b2ee4
commit
c29b533cf1
@@ -4,6 +4,15 @@ echo 'It''s a string'
|
||||
echo 'tab: \t, new line: \n, backslash: \\'
|
||||
echo "tab: \t, new line: \n, backslash: \\"
|
||||
|
||||
" string starts immediately after line continuation character - tests a
|
||||
" comment/string distinguishing implementation quirk
|
||||
echo "foo"
|
||||
\"bar"
|
||||
\ "baz"
|
||||
echo 'foo'
|
||||
\'bar'
|
||||
\ 'baz'
|
||||
|
||||
" String escape sequences
|
||||
|
||||
echo "\316 - \31 - \3 - \x1f - \xf - \X1F - \XF - \u02a4 - \U000002a4 - \b - \e - \f - \n - \r - \t - \\ - \" - \<C-W>"
|
||||
@@ -21,6 +30,13 @@ echo "\<*C->>"
|
||||
echo "\<C->>>"
|
||||
echo "\<*C->>>"
|
||||
|
||||
echo ""
|
||||
echo "\""
|
||||
echo "foo\""
|
||||
echo "\"foo"
|
||||
echo "foo\"bar"
|
||||
|
||||
echo ''
|
||||
echo ''''
|
||||
echo '''foo'
|
||||
echo 'foo'''
|
||||
@@ -30,6 +46,7 @@ echo 'foo''bar'
|
||||
" https://github.com/tpope/vim-unimpaired/blob/6d44a6dc2ec34607c41ec78acf81657248580bf1/plugin/unimpaired.vim#L232
|
||||
let cmd = 'put!=repeat(nr2char(10), v:count1)|silent '']+'
|
||||
|
||||
|
||||
" String interpolation
|
||||
|
||||
echo 'Don''t highlight interpolation: {{ {1 + 2} }}'
|
||||
@@ -39,10 +56,61 @@ echo $'Highlight interpolation:\t{{ { $'nested: {{ {1 + 2} }}' } }}'
|
||||
echo $"Highlight interpolation:\t{{ { string({"foo": "bar"}) } }}"
|
||||
echo $"Highlight interpolation:\t{{ { $"nested: {{ {1 + 2} }}" } }}"
|
||||
|
||||
echo $''''
|
||||
echo $'''foo'
|
||||
echo $'foo'''
|
||||
echo $'foo''bar'
|
||||
|
||||
" Continued string
|
||||
|
||||
let s = "
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\" " tail comment
|
||||
|
||||
let s = "\"
|
||||
\\" part 1 \"
|
||||
"\ escape sequence
|
||||
\ \"part 2\"
|
||||
\\"" " tail comment
|
||||
|
||||
let s = '
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\' " tail comment
|
||||
|
||||
let s = '''
|
||||
\'' part 1 ''
|
||||
"\ escape sequence
|
||||
\ ''part 2''
|
||||
\''' " tail comment
|
||||
|
||||
let s = $"
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\" " tail comment
|
||||
|
||||
let s = $'
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\' " tail comment
|
||||
|
||||
call strlen("part 1
|
||||
"\ comment
|
||||
\ part 2")
|
||||
|
||||
call append(0, "part 1
|
||||
"\ comment
|
||||
\ part 2")
|
||||
|
||||
|
||||
" Number
|
||||
|
||||
@@ -301,12 +369,17 @@ let foo = foo +
|
||||
\ bar +
|
||||
\ "baz"
|
||||
|
||||
let foo = foo +
|
||||
"\ "comment string"
|
||||
\ bar
|
||||
|
||||
" Function calls
|
||||
|
||||
call Foo(v:true, v:false, v:null)
|
||||
|
||||
|
||||
" Issue #16221 (vimString becomes vimVar when preceded by !)
|
||||
|
||||
let bar = !'g:bar'->exists()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user