How can I teach vim about additional C language types for syntax highlighting?
c, types, vim, vim-syntax-highlighting
Solution
Here is a way to add the names as needed.
For Windows, create (replace `vimfiles` as appropriate)
~\vimfiles\after\syntax\c.vim
and add lines defining new syntax highlighting items. For example (from my `cpp.vim`),
" add nullptr as a keyword for highlighting
syn keyword Constant nullptr
To determine which group you want to add to, open a c file and type `:syntax` and you can look through the existing syntax groups.
Problem
Syntax highlighting works swimmingly beautiful with the standard types, like `int`, `uint32_t`, `float` and so on. However, I would like to teach vim that there are other types defined with typedef in my code, e.g. ``` typedef double float64_t; ``` How can I make vim use the same highlighting for `float64_t` as for the standard types? A solution with a local file (e.g. within my `~/.vimrc` or `.vim` directory) would be preferred. Automatic parsing of typedef names not a requirement, I'm willing to add typedef names as needed.