From 0f1ea022e96f972a0d5287d79be1ed254e89dce5 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Tue, 27 Mar 2012 22:28:35 +0200 Subject: [PATCH] add ReadConfig to C++ checker as well --- syntax_checkers/cpp.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/syntax_checkers/cpp.vim b/syntax_checkers/cpp.vim index 7fe2e0ec..20528e47 100644 --- a/syntax_checkers/cpp.vim +++ b/syntax_checkers/cpp.vim @@ -46,6 +46,13 @@ " " let g:syntastic_cpp_compiler_options = ' -std=c++0x' " +" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define +" a file that contains additional compiler arguments like include directories +" or CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_cpp_config': +" +" let g:syntastic_cpp_config_file = '.config' +" " Using the global variable 'g:syntastic_cpp_remove_include_errors' you can " specify whether errors of files included via the " g:syntastic_cpp_include_dirs' setting are removed from the result set: @@ -64,6 +71,10 @@ endif let s:save_cpo = &cpo set cpo&vim +if !exists('g:syntastic_cpp_config_file') + let g:syntastic_cpp_config_file = '.syntastic_cpp_config' +endif + function! SyntaxCheckers_cpp_GetLocList() let makeprg = 'g++ -fsyntax-only ' let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' @@ -101,6 +112,9 @@ function! SyntaxCheckers_cpp_GetLocList() let makeprg .= b:syntastic_cpp_cflags endif + " add optional config file parameters + let makeprg .= syntastic#c#ReadConfig(g:syntastic_cpp_config_file) + " process makeprg let errors = SyntasticMake({ 'makeprg': makeprg, \ 'errorformat': errorformat })