In particular, the display of initialization lists is really bad:
vector v({1,2,3});
will highlight the curly braces in red (den
As far as I know, there is a work in progress for that, see here at the vim_dev mail list.
You can also configure this in a local syntastic config file.
Drop a .syntastic_cpp_config
file in your project root and give it the compiler arguments one per line (I also have include paths for the Loki library as an example):
-std=c++11
-Ilib/loki/include
-Ilib/loki_book/include
An improved patch for C++11 support has been sent to the mailing list: https://groups.google.com/forum/?fromgroups#!topic/vim_dev/ug_wmWQqyGU
As an alternative, you can use
let c_no_curly_error=1
in your .vimrc
file so that vim doesn't tag {}
as error in ()
.
If you use Syntastic, add this to your .vimrc (or .vimrc.local).
let g:syntastic_cpp_compiler_options = ' -std=c++11'
Syntastic shows errors for code written in multiple languages. Each language has a "checker" which is a wrapper to execute an external program. The external program for the c++ checker is g++. The c++ checker can pass compiler options to g++ and can be configured.
https://github.com/scrooloose/syntastic/wiki/C--:---gcc
If you want to use clang++, you can use these options
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
I have searched the other proposals about C++11 syntax file of VIM and they are old and not maintained. Anyway, recent distributions of Vim have good syntax files already. Sometimes they are updated though and official source of syntax files is here: https://github.com/vim-jp/vim-cpp