This file contains additional syntax highlighting that I use for C++11/14 development in Vim. Compared to the standard syntax highlighting for C++ it adds highlighting of (user defined) functions and the containers and types in the standard library / boost.
Development is done at: http://github.com/octol/vim-cpp-enhanced-highlight
Highlighting of class scope is disabled by default. To enable set
let g:cpp_class_scope_highlight = 1
Highlighting of template functions is enabled by setting
let g:cpp_experimental_template_highlight = 1
Note: C++ template syntax is notoriously difficult to parse, so don't expect this feature to be perfect.
Follow one of the sets of directions below and reload vim afterwards.
Instal using vundle by adding
Plugin 'octol/vim-cpp-enhanced-highlight'
to .vimrc and run :PluginInstall
.
If you have pathogen installed, and you prefer to use git submodules, run
cd ~/.vim
git submodule add https://github.com/octol/vim-cpp-enhanced-highlight.git bundle/syntax/
If you don't have either Vundle or Pathogen installed, copy the cpp.vim file (optionally also c.vim) to .vim/after/syntax.
git clone https://github.com/octol/vim-cpp-enhanced-highlight.git /tmp/vim-cpp-enhanced-highlight
mkdir -p ~/.vim/after/syntax/
mv /tmp/vim-cpp-enhanced-highlight/after/syntax/cpp.vim ~/.vim/after/syntax/cpp.vim
rm -rf /tmp/vim-cpp-enhanced-highlight
Vim tend to a have issues with flagging braces as errors, see for example vim-jp/vim-cpp#16. A workaround is to set
let c_no_curly_error=1
- http://stackoverflow.com/questions/736701/class-function-names-highlighting-in-vim
- http://www.vim.org/scripts/script.php?script_id=4293
- http://www.vim.org/scripts/script.php?script_id=2224
- http://www.vim.org/scripts/script.php?script_id=1640
- http://www.vim.org/scripts/script.php?script_id=3064
Jon Haggblad jon@haeggblad.com
Last update: 21 September 2014