vim-cpp-enhanced-highlight icon indicating copy to clipboard operation
vim-cpp-enhanced-highlight copied to clipboard

Add option to not highlight std:: namespace functions (i.e., cppSTLfunction) unless prefixed with std::

Open anntzer opened this issue 9 years ago • 2 comments

There's a lot of names defined in the cppSTLfunction syntax group. In practice this easily leads to spurious highlighting, especially in a programming style where these functions would always be called with the std:: namespace explicitly.

Bonus points if you can auto-detect whether there's a using namespace std; in the current scope, but I think this may be a bit too difficult to be worth it?

anntzer avatar Oct 30 '16 22:10 anntzer

Sounds like something that could be useful to look into in the future. Thanks for the suggestion.

octol avatar Feb 12 '17 20:02 octol

Something like

syntax region cppSTLscoped start='\(std\)\@3<=::\<' end='\>' contains=cppSTLtype

syntax keyword cppSTLtype allocator contained
syntax keyword cppSTLtype auto_ptr contained
syntax keyword cppSTLtype basic_filebuf contained
...

(with separate groups for each namespace if we want to actually check the namespace, or with a single container group just checking for a preceding ::) works.

anntzer avatar Aug 18 '17 11:08 anntzer