diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index a481e46f..15017fad 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -10,6 +10,13 @@ " "============================================================================ +" NOTE: IF you are using the YouCompleteMe plugin +" (https://github.com/Valloric/YouCompleteMe), everything will 'just work' +" (if you configured YouCompleteMe properly that is). +" Ignore all the below g:syntastic_cpp* options, YCM does not use them. If you +" are NOT using YCM, then continue reading. +" +" " In order to also check header files add this to your .vimrc: " " let g:syntastic_c_check_header = 1 @@ -73,7 +80,7 @@ if exists('loaded_gcc_syntax_checker') endif let loaded_gcc_syntax_checker = 1 -if !executable(g:syntastic_c_checker) +if !executable(g:syntastic_c_checker) && !exists('g:loaded_youcompleteme') finish endif @@ -89,6 +96,10 @@ if !exists('g:syntastic_c_config_file') endif function! SyntaxCheckers_c_GetLocList() + if exists('g:loaded_youcompleteme') + return youcompleteme#CurrentFileDiagnostics() + endif + let makeprg = g:syntastic_c_checker . ' -x c -fsyntax-only ' let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '. \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '. diff --git a/syntax_checkers/objc.vim b/syntax_checkers/objc.vim index c532e10f..36f6122a 100644 --- a/syntax_checkers/objc.vim +++ b/syntax_checkers/objc.vim @@ -10,6 +10,13 @@ " "============================================================================ +" NOTE: IF you are using the YouCompleteMe plugin +" (https://github.com/Valloric/YouCompleteMe), everything will 'just work' +" (if you configured YouCompleteMe properly that is). +" Ignore all the below g:syntastic_cpp* options, YCM does not use them. If you +" are NOT using YCM, then continue reading. +" +" " In order to also check header files add this to your .vimrc: " (this usually creates a .gch file in your source directory) " @@ -64,7 +71,7 @@ " " let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m' -if !executable('gcc') +if !executable('gcc') && !exists('g:loaded_youcompleteme') finish endif @@ -80,8 +87,12 @@ if !exists('g:syntastic_objc_config_file') endif function! SyntaxCheckers_objc_GetLocList() + if exists('g:loaded_youcompleteme') + return youcompleteme#CurrentFileDiagnostics() + endif + let makeprg = 'gcc -fsyntax-only -lobjc' - let errorformat = + let errorformat = \ '%-G%f:%s:,'. \ '%f:%l:%c: %trror: %m,'. \ '%f:%l:%c: %tarning: %m,'. diff --git a/syntax_checkers/objcpp.vim b/syntax_checkers/objcpp.vim new file mode 100644 index 00000000..aa858fcd --- /dev/null +++ b/syntax_checkers/objcpp.vim @@ -0,0 +1,27 @@ +"============================================================================ +"File: objcpp.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Val Markovic +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +" NOTE: This plugin only supports use of the YouCompleteMe Vim plugin as the +" source of the diagnostics. If you would like to have Syntastic support without +" the use of YCM, feel free to contribute changes to this file. + +if exists("loaded_objcpp_syntax_checker") + finish +endif +let loaded_objcpp_syntax_checker = 1 + +if !exists('g:loaded_youcompleteme') + finish +endif + +function! SyntaxCheckers_objcpp_GetLocList() + return youcompleteme#CurrentFileDiagnostics() +endfunction