sponsor Vim development Vim logo Vim Book Ad

SemanticHL : Semantic highlighting for C/C++ (v1.0 20140521)

 script karma  Rating 4/8, Downloaded by 1236  Comments, bugs, improvements  Vim wiki

created by
John Leimon
script type
Adds semantic highlighting to C/C++ symbols


Assigns the color of a C/C++ symbol using the hash of the symbol string as a key to a color table that spans the line between minimum and maximum hue. Color table customizable by editing script. Behavior of color assignment customizable by editing hash function.

Known defects

- The 'define' in a '#define' preprocessor definition may be incorrectly colorized.

- The semantic parsing algorithm is approximately O(n). Where 'n' is the number of non-syntax symbols in a buffer. Large files may be slow to process on your machine.

- Only available in gvim.
install details

Vim home directory is ~/.vim


1. Copy 'cpp_sem.vim' and 'c_sem.vim' to ~/.vim/syntax.
2. Copy 'semantic.vim' to ~/.vim/ftdetect

Semantic highlighting will be enabled automatically for files with c/cpp/h/hpp extensions.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
semantic.zip 1.1 2014-06-10 7.0 John Leimon Removed semantic highlight parsing from autocmd hooks: CursorMovedI and CursorMoved. This is to prevent noticeable UI performance degradation while editing some buffers on some systems.
semantic.zip 1.0 2014-05-22 7.0 John Leimon Latest and greatest.
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.