Skip to content

dncnmcdougall/vim-cpp-enhanced-highlight

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 

Repository files navigation

vim.cpp - additional vim c++ syntax highlighting

This file contains additional syntax highlighting that I use for C++11/14/17 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

Screenshot

Optional features

Highlighting of class scope is disabled by default. To enable set

let g:cpp_class_scope_highlight = 1

There are two ways to hightlight template functions. Either

let g:cpp_experimental_simple_template_highlight = 1

which works in most cases, but can be a little slow on large files. Alternatively set

let g:cpp_experimental_template_highlight = 1

which is a faster implementation but has some corner cases where it doesn't work.

Note: C++ template syntax is notoriously difficult to parse, so don't expect this feature to be perfect.

Highlighting of library concepts is enabled by

let g:cpp_concepts_highlight = 1

This will highlight the keywords concept and requires as well as all named requirements (like DefaultConstructible) in the standard library.

Installation instructions

Follow one of the sets of directions below and reload vim afterwards.

Vundle

Install using vundle by adding

Plugin 'octol/vim-cpp-enhanced-highlight'

to .vimrc and run :PluginInstall.

Git submodule + Pathogen

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/

Manual installation

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

Issues

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

Background information

Jon Haggblad jon@haeggblad.com

Last update: 19 October 2016

About

Additional Vim syntax highlighting for C++ (including C++11/14)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 95.3%
  • C++ 4.7%