yongzhy
yongzhy

Reputation: 977

VIM How to get the definition for a syntax region

If there a syntax region definition, how to get the definition using VimL or Python?

eg, below is a definition, how can I get the data start from start

syntax region potionString start=/\v"/ skip=/\v\\./ end=/\v"/

Upvotes: 0

Views: 125

Answers (1)

svlasov
svlasov

Reputation: 10456

This will match start value till the next whitespace.

syntax region potionString start=/\v"/ skip=/\v\\./ end=/\v"/

redir @a
silent syntax list potionString
redir END

let def=split(@a, '\n')[1]
let start=matchstr(def, "start=\\zs.*\\ze\s")
echo start

Upvotes: 1

Related Questions