-1

In vim, I can use

syn match myVar "\v\w+\s*(\=)@="

to match a string such as "abc =" to highlight the variable abc.

Then I tried to match string such as " -> abc" and capture the abc as a variable but failed -- I used

syn match myVar "\v(-\>)\s*\w+"

, it sort of worked, but the arrow "->" is also captured.

I tried

syn match myVar "\v(-\>)\s*\w+@="

, but even worse, it reports an error

E871: (NFA regexp) Cannot have a multi follow a multi
E475: Invalid argument: myVar "\v(-\>)\s*\w+@="

How could I capture the variable only?

athos
  • 6,120
  • 5
  • 51
  • 95

0 Answers0