I want to use syntax highlighting for custom C types. Based on my coding convention, types can occur in the following places:
typedef type1 type2; (static | extern | register | volatile)? type ...; (struct | enum | union) type ...; func(type1 x, type2 x, ...); // might be a harder case
It doesn't include all the situations, but can already cover probably more than 90% of the usage. It seems to me like just a simple pattern matching problem, but I was a bit frustrated playing with vim syntax script, and couldn't get what I need. For example, I don't know how to match part of the pattern without highlighting the rest. Any ideas how to do it?
\zeare great for defining the start and end of the matching part of your pattern
type namefollowing and preceding any number of things like
type name. Each parameter will match that same pattern.