-
Vim's regex-based syntax highlighting cannot detect variables in C code. If you don't mind switching to Neovim, you can use nvim-treesitter to use tree-sitter queries to highlight C files (a default set of queries is available out of the box, which do highlight variables) instead.
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
vim-lsp-cxx-highlight
Discontinued Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
By looking around the Web, I think you can maybe do what you want in Vim with this plugin, which requires you to setup an LSP server for C (note: I haven't tried it). Otherwise, the way Vim makes its syntax highlighting (natively) simply cannot compete with tree-sitter or LSP-based highlighting which construct the entire AST of your code, because C's syntax is too complex. There is a proposal to include an alternative syntax highlighting system, but work on it hasn't even started as far as I know, so vim-lsp-cxx-highlight and tree-sitter are really the only way to highlight identifiers in C/C++.
-
By looking around the Web, I think you can maybe do what you want in Vim with this plugin, which requires you to setup an LSP server for C (note: I haven't tried it). Otherwise, the way Vim makes its syntax highlighting (natively) simply cannot compete with tree-sitter or LSP-based highlighting which construct the entire AST of your code, because C's syntax is too complex. There is a proposal to include an alternative syntax highlighting system, but work on it hasn't even started as far as I know, so vim-lsp-cxx-highlight and tree-sitter are really the only way to highlight identifiers in C/C++.
Related posts
-
What I've Learned About My Editing Skills
-
Bram Moolenaar Passed Away
-
Inconsistent instructions on NeoVim's user manual
-
How can I create a new mode in vim? My goal is to create a way for vscode users or other text editor users to code in vim with their common keyboard shortcuts (e.g. <C-z> undo, <C-c> copy, <c-v> paste, etc. )
-
Looking for a C IDE better than VSCode