c, objc and objcpp support

This commit is contained in:
Strahinja Val Markovic 2013-01-14 21:11:44 -08:00
parent 0040afbaf6
commit b93e51e260
3 changed files with 52 additions and 3 deletions

View File

@ -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 '.

View File

@ -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,6 +87,10 @@ 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 =
\ '%-G%f:%s:,'.

View File

@ -0,0 +1,27 @@
"============================================================================
"File: objcpp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"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