When I put the cursor on a parenthesis in vim:
f = (\x y -> x+y)
^
typing % will move the cursor to the matching parenthesis:
f = (\x y -> x+y)
^
typing %d will delete the parentheses and everything in them
f =
^
but when I have nested parentheses:
g = (\(x,y) -> x+y)
^
typing % makes it jump to the closing inner parenthesis instead of the matching one:
g = (\(x,y) -> x+y)
^
and %d has the same mismatching behavior:
g = (\(x,y) -> x+y)
^
becomes
g = -> x+y)
^
Why? How can I make it match properly?
Oddly, the visual highlighting of matching parentheses does work:






How does this work but then the matching by % doesn't? Are there two brains?