I want to highlight if defined with #define in Vim. For example, if I type #define ZERO 0, highlight ZERO with a different color.

  • 2
    This is pretty tricky to do, since Vim applies syntax highlighting as regular expressions. It needs to know about the CPP syntax to "see" that ZERO is a defined constant. You need to interface with some external tool for this; perhaps something like this exists already (ctags? LSP?) but generally speaking this is not the kind of thing Vim is very good at. – Martin Tournoij Feb 20 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.