I saw that it's possible to manually add types to highlight, according to this post: https://stackoverflow.com/questions/20149478/how-can-i-teach-vim-about-additional-c-language-types-for-syntax-highlighting

However I was wondering if it's possible for vim to automatically highlight typedefs?

  • Your question is a bit unclear—do you mean that you want, e.g., typedef foo int to now highlight all foos as types? If you just use regex, it's likely to be buggy (foo foo is valid, and declares a variable foo of type int). You'd need a fully syntax parser that could then tell vim what to do.
    – D. Ben Knoble
    Commented Dec 11, 2019 at 14:38
  • yes that's what I mean. I wonder if the YouCompletMe plugin can do this, since its a supposed to be a code comprehension plugin.
    – mbl
    Commented Dec 11, 2019 at 14:51
  • 1
    If you use ctags (or adopting ctags is acceptable), then consider this one: stackoverflow.com/a/5842242/9447571
    – filbranden
    Commented Dec 12, 2019 at 1:59