# Dynamic Syntax Highlighting in Vim I'm a huge fan of syntax highlighting in my editor Vim. One thing I started to miss was that user defined type miss out on the highlighting, because Vim does not know about them. Wouldn't it be cool to have some sort of automatic support that detect *your* types and adds them to the correct highlighting group? I call this "dynamic syntax highlighting". As a proof-of-concept I took the [tagbar plugin](http://majutsushi.github.com/tagbar/), and modified it a little to take advantage of the language detection (specifically the types). The modified code can be found [in my fork on github](https://github.com/miekg/tagbar). It works as follows for Go code. Editing `dnssec.go` from [my Go DNS repo](https://github.com/miekg/ldns). ![Here you see a user defined type `rrsigWireFmt` which isn't colored like `uint16`, `uint8`, etc.](/images/2012/dnssec-normal-highlight.png "Normal syntax highlighting") Now I fire up `:TagbarToggle`, which detect the stuff in my file *and* adds highlighting. ![`rrsigWireFmt` is recognized!](/images/2012/dnssec-types-highlight.png "Normal syntax highlighting") There is of course work left, cleaning out stuff from tagbar which I don't need, supporting multiple files (type defined in X, but you're editing Y), etc.