3
1
let g:syntastic_c_compiler = 'clang'
let g:syntastic_c_compiler_options = ' -ansi -pedantic'
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++ -pedantic
That was easy, wasn't it? How do I do the same thing with Valloric's YouCompleteMe? The "User Guide" suggests to have a seperate configuration file in each project, and manually edit the flags - which is ridiculous. How can I change the flags based on the filetype in my .ycm_extra_conf.py
? My attempt:
1
2 def FlagsForFile(filename, **kwargs):
3 flags = [
4 '-Wall',
5 '-Wextra',
6 '-Werror',
7 '-pedantic'
8 ]
9 data = kwargs['client_data']
10 filetype = data['&filetype']
11 if filetype == 'c':
12 flags += ['-ansi']
13 elif filetype == 'cpp':
14 flags += ['-std=c++11']
15 flags += ['stdlib=libc++']
16 return {
17 'flags': flags,
18 'do_cache': True
19 }
Where and what did you set kwargs to? – FDinoff – 2014-11-24T14:41:33.323