Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Highlight C++ variables using scope?

I would like to have C++ variables highlighted by scope. E.g. variables should have different coloring depending on file, class, global or local scope. Is it possible?

UPDATE: External helpers (e.g. ctags/clang and vim scripts) are welcome.

UPDATE 2: This really should be possible using libclang. Take a look at Doug Gregor presentations here: http://llvm.org/devmtg/2010-11/ I think just no one has done it yet... or?

like image 784
Johan Kotlinski Avatar asked Feb 16 '11 21:02

Johan Kotlinski


1 Answers

http://www.vim.org/scripts/script.php?script_id=2646

From the script website:

This set of scripts is designed to increase the number of highlighting groups used by Vim. This makes it quicker and easier to spot errors in your code. By using ctags and parsing the output, the typedefs, #defines, enumerated names etc are all clearly highlighted in different colors.

There are some screenshots available to show the comparison.

http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting

like image 101
Amjith Avatar answered Oct 17 '22 05:10

Amjith