Hi Christian, As described below, the highlighting performed by :MatchParen gets confused by the AC_MSG_* syntax region.
On Mon, Nov 13, 2017 at 10:36:35PM +0100, Ferenc Wágner wrote: > Please create /tmp/configure.ac with the following contents: > > [AC_MSG_([yes])] > > and position the cursor on the first character, the opening bracket. > This highlights the first closing bracket, right after "yes", instead > of the closing bracket at the end of the line. However, hitting % > correctly jumps to the end of the line. ":help pi_paren" explains the problem > The syntax highlighting attributes are used. When the cursor currently is not > in a string or comment syntax item, then matches inside string and comment > syntax items are ignored. Any syntax items with "string" or "comment" > somewhere in their name are considered string or comment items. Since the opening ([ are highlighted as configstring, they aren't considered a valid match for the closing ]). Changing the syntax region's name to configmsg, like in the attached patch, fixes the problem. The contents are still highlighted like a string, but it doesn't confuse the paren matching. Cheers, -- James GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7 2D23 DFE6 91AE 331B A3DB
diff --git i/runtime/syntax/config.vim w/runtime/syntax/config.vim index c6d4e6b36..76da12cec 100644 --- i/runtime/syntax/config.vim +++ w/runtime/syntax/config.vim @@ -30,8 +30,8 @@ syn keyword configspecial cat rm eval syn region configstring start=+\z(["'`]\)+ skip=+\\\z1+ end=+\z1+ contains=@Spell " Anything inside AC_MSG_TYPE([...]) and AC_MSG_TYPE(...) is a string. -syn region configstring matchgroup=configfunction start="AC_MSG_[A-Z]*\ze(\[" matchgroup=configdelimiter end="\])" contains=configdelimiter,@Spell -syn region configstring matchgroup=configfunction start="AC_MSG_[A-Z]*\ze([^[]" matchgroup=configdelimiter end=")" contains=configdelimiter,@Spell +syn region configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze(\[" matchgroup=configdelimiter end="\])" contains=configdelimiter,@Spell +syn region configmsg matchgroup=configfunction start="AC_MSG_[A-Z]*\ze([^[]" matchgroup=configdelimiter end=")" contains=configdelimiter,@Spell " Define the default highlighting. " Only when an item doesn't have highlighting yet @@ -45,6 +45,7 @@ hi def link confignumber Number hi def link configkeyword Keyword hi def link configspecial Special hi def link configstring String +hi def link configmsg String let b:current_syntax = "config"