vim --clean.#!/bin/bash echo foo declare -A bar=( [\(\)]="baz" ) echo ${bar[\(\)]}
echo on the last line is highlighted as shArrayValue.The echo on the last line is highlighted as shStatement, like the echo on the second line.
9.1.1888
Operating system: Arch Linux
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This has been happening since 48fa319. However the behavior before that commit may also be incorrect.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The shEscape business is beyond my ken. Unlike " or ' that
run in couples, \\* have no balanced counterpart to look
for. An escaped character or a series of characters that
form a unit ought to be matched and coloured in some manner.
After the escaped character of a series is claimed, the
remaining characters are fair game for further matching.
I tentatively suggest this change:
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 5cf493065..be1ea1840 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -603,7 +603,7 @@ syn match shVariable "\<\h\w*\ze=" nextgroup=shVarAssign if exists("b:is_bash") " The subscript form for array values, e.g. "foo=([2]=10 [4]=100)". syn region shArrayValue contained start="\[\%(..\{-}\]=\)\@=" end="\]=\@=" contains=@shArrayValueList nextgroup=shVarAssign - syn cluster shArrayValueList contains=shArithmetic,shArithParen,shCommandSub,shDeref,shDerefSimple,shExpr,shNumber,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shSpecial,shParen,bashSpecialVariables,shParenError + syn cluster shArrayValueList contains=shArithmetic,shArithParen,shCommandSub,shDeref,shDerefSimple,shExpr,shNumber,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shSpecial,shParen,bashSpecialVariables,shParenError,shEscape syn region shArrayRegion contained matchgroup=shShellVariables start="(" skip='\\\\\|\\.' end=")" contains=@shArrayValueList,shArrayValue,shComment elseif (exists("b:is_kornshell") && !exists("b:is_ksh88")) " The subscript form for array values, e.g. "foo=([2]=10 [4]=100)".
(This would break up a series in testdir/input/sh_12.vim.)
On the other hand:
syn clear shEscape
and resorting to paired quoting is another way to deal with
it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()