Merge remote-tracking branch 'scrooloose/master'
This commit is contained in:
commit
1fc5f28583
@ -101,7 +101,7 @@ function! syntastic#c#ReadConfig(file)
|
||||
|
||||
let parameters = []
|
||||
for line in lines
|
||||
let matches = matchlist(line, '^\s*-I\s*\(\S\+\)')
|
||||
let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)')
|
||||
if matches != [] && matches[1] != ''
|
||||
" this one looks like an absolute path
|
||||
if match(matches[1], '^\%(/\|\a:\)') != -1
|
||||
|
@ -11,10 +11,16 @@
|
||||
"============================================================================
|
||||
|
||||
if !exists('g:syntastic_c_checker')
|
||||
let g:syntastic_c_checker = "gcc"
|
||||
if exists('g:loaded_youcompleteme')
|
||||
let g:syntastic_c_checker = "ycm"
|
||||
else
|
||||
let g:syntastic_c_checker = "gcc"
|
||||
endif
|
||||
endif
|
||||
|
||||
if g:syntastic_c_checker == "gcc" || g:syntastic_c_checker == "clang"
|
||||
if g:syntastic_c_checker == "ycm"
|
||||
runtime! syntax_checkers/c/ycm.vim
|
||||
elseif g:syntastic_c_checker == "gcc" || g:syntastic_c_checker == "clang"
|
||||
if executable(g:syntastic_c_checker)
|
||||
runtime! syntax_checkers/c/gcc.vim
|
||||
endif
|
||||
|
25
syntax_checkers/c/ycm.vim
Normal file
25
syntax_checkers/c/ycm.vim
Normal file
@ -0,0 +1,25 @@
|
||||
"============================================================================
|
||||
"File: ycm.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.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("loaded_ycm_c_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_ycm_c_syntax_checker = 1
|
||||
|
||||
if !exists('g:loaded_youcompleteme')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_c_GetLocList()
|
||||
return youcompleteme#CurrentFileDiagnostics()
|
||||
endfunction
|
||||
|
@ -1,7 +1,7 @@
|
||||
"============================================================================
|
||||
"File: cpp.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"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
|
||||
@ -10,147 +10,19 @@
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" in order to also check header files add this to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_no_include_search = 1
|
||||
"
|
||||
" To disable the include of the default include dirs (such as /usr/include)
|
||||
" add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_no_default_include_dirs = 1
|
||||
"
|
||||
" In order to add some custom include directories that should be added to the
|
||||
" gcc command line you can add those to the global variable
|
||||
" g:syntastic_cpp_include_dirs. This list can be used like this:
|
||||
"
|
||||
" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ]
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
|
||||
" on the next file write.
|
||||
"
|
||||
" let g:syntastic_cpp_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
|
||||
"
|
||||
" 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:
|
||||
"
|
||||
" let g:syntastic_cpp_remove_include_errors = 1
|
||||
"
|
||||
" Use the variable 'g:syntastic_cpp_errorformat' to override the default error
|
||||
" format:
|
||||
"
|
||||
" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m'
|
||||
"
|
||||
" Set your compiler executable with e.g. (defaults to g++)
|
||||
"
|
||||
" let g:syntastic_cpp_compiler = 'clang++'
|
||||
|
||||
if !exists('g:syntastic_cpp_compiler')
|
||||
let g:syntastic_cpp_compiler = 'g++'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_cpp_compiler_options')
|
||||
let g:syntastic_cpp_compiler_options = ''
|
||||
endif
|
||||
|
||||
if !executable(g:syntastic_cpp_compiler)
|
||||
finish
|
||||
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:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' .
|
||||
\ g:syntastic_cpp_compiler_options
|
||||
let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '.
|
||||
\ '%m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,'.
|
||||
\ '%f:%l: %m'
|
||||
|
||||
if exists('g:syntastic_cpp_errorformat')
|
||||
let errorformat = g:syntastic_cpp_errorformat
|
||||
endif
|
||||
|
||||
let makeprg .= ' ' . shellescape(expand('%')) .
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
|
||||
|
||||
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
|
||||
if exists('g:syntastic_cpp_check_header')
|
||||
let makeprg = g:syntastic_cpp_compiler.' -c '.shellescape(expand('%')) .
|
||||
\ ' ' . g:syntastic_cpp_compiler_options .
|
||||
\ ' ' . syntastic#c#GetNullDevice() .
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists('b:syntastic_cpp_cflags')
|
||||
if !exists('g:syntastic_cpp_no_include_search') ||
|
||||
\ g:syntastic_cpp_no_include_search != 1
|
||||
if exists('g:syntastic_cpp_auto_refresh_includes') &&
|
||||
\ g:syntastic_cpp_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#c#SearchHeaders()
|
||||
else
|
||||
if !exists('b:syntastic_cpp_includes')
|
||||
let b:syntastic_cpp_includes = syntastic#c#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_cpp_includes
|
||||
endif
|
||||
endif
|
||||
if !exists('g:syntastic_cpp_checker')
|
||||
if exists('g:loaded_youcompleteme')
|
||||
let g:syntastic_cpp_checker = "ycm"
|
||||
else
|
||||
let makeprg .= b:syntastic_cpp_cflags
|
||||
let g:syntastic_cpp_checker = "gcc"
|
||||
endif
|
||||
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 })
|
||||
|
||||
" filter the processed errors if desired
|
||||
if exists('g:syntastic_cpp_remove_include_errors') &&
|
||||
\ g:syntastic_cpp_remove_include_errors != 0
|
||||
return filter(errors,
|
||||
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
|
||||
else
|
||||
return errors
|
||||
if g:syntastic_cpp_checker == "ycm"
|
||||
runtime! syntax_checkers/cpp/ycm.vim
|
||||
elseif g:syntastic_cpp_checker == "gcc" || g:syntastic_cpp_checker == "clang"
|
||||
if executable(g:syntastic_cpp_checker)
|
||||
runtime! syntax_checkers/cpp/gcc.vim
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
|
156
syntax_checkers/cpp/gcc.vim
Normal file
156
syntax_checkers/cpp/gcc.vim
Normal file
@ -0,0 +1,156 @@
|
||||
"============================================================================
|
||||
"File: cpp.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"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.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" in order to also check header files add this to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_no_include_search = 1
|
||||
"
|
||||
" To disable the include of the default include dirs (such as /usr/include)
|
||||
" add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cpp_no_default_include_dirs = 1
|
||||
"
|
||||
" In order to add some custom include directories that should be added to the
|
||||
" gcc command line you can add those to the global variable
|
||||
" g:syntastic_cpp_include_dirs. This list can be used like this:
|
||||
"
|
||||
" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ]
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
|
||||
" on the next file write.
|
||||
"
|
||||
" let g:syntastic_cpp_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
|
||||
"
|
||||
" 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:
|
||||
"
|
||||
" let g:syntastic_cpp_remove_include_errors = 1
|
||||
"
|
||||
" Use the variable 'g:syntastic_cpp_errorformat' to override the default error
|
||||
" format:
|
||||
"
|
||||
" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m'
|
||||
"
|
||||
" Set your compiler executable with e.g. (defaults to g++)
|
||||
"
|
||||
" let g:syntastic_cpp_compiler = 'clang++'
|
||||
|
||||
if !exists('g:syntastic_cpp_compiler')
|
||||
let g:syntastic_cpp_compiler = 'g++'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_cpp_compiler_options')
|
||||
let g:syntastic_cpp_compiler_options = ''
|
||||
endif
|
||||
|
||||
if !executable(g:syntastic_cpp_compiler)
|
||||
finish
|
||||
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:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' .
|
||||
\ g:syntastic_cpp_compiler_options
|
||||
let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '.
|
||||
\ '%m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,'.
|
||||
\ '%f:%l: %m'
|
||||
|
||||
if exists('g:syntastic_cpp_errorformat')
|
||||
let errorformat = g:syntastic_cpp_errorformat
|
||||
endif
|
||||
|
||||
let makeprg .= ' ' . shellescape(expand('%')) .
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
|
||||
|
||||
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
|
||||
if exists('g:syntastic_cpp_check_header')
|
||||
let makeprg = g:syntastic_cpp_compiler.' -c '.shellescape(expand('%')) .
|
||||
\ ' ' . g:syntastic_cpp_compiler_options .
|
||||
\ ' ' . syntastic#c#GetNullDevice() .
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists('b:syntastic_cpp_cflags')
|
||||
if !exists('g:syntastic_cpp_no_include_search') ||
|
||||
\ g:syntastic_cpp_no_include_search != 1
|
||||
if exists('g:syntastic_cpp_auto_refresh_includes') &&
|
||||
\ g:syntastic_cpp_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#c#SearchHeaders()
|
||||
else
|
||||
if !exists('b:syntastic_cpp_includes')
|
||||
let b:syntastic_cpp_includes = syntastic#c#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_cpp_includes
|
||||
endif
|
||||
endif
|
||||
else
|
||||
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 })
|
||||
|
||||
" filter the processed errors if desired
|
||||
if exists('g:syntastic_cpp_remove_include_errors') &&
|
||||
\ g:syntastic_cpp_remove_include_errors != 0
|
||||
return filter(errors,
|
||||
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
|
||||
else
|
||||
return errors
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
25
syntax_checkers/cpp/ycm.vim
Normal file
25
syntax_checkers/cpp/ycm.vim
Normal file
@ -0,0 +1,25 @@
|
||||
"============================================================================
|
||||
"File: ycm.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.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("loaded_ycm_cpp_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_ycm_cpp_syntax_checker = 1
|
||||
|
||||
if !exists('g:loaded_youcompleteme')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_cpp_GetLocList()
|
||||
return youcompleteme#CurrentFileDiagnostics()
|
||||
endfunction
|
||||
|
@ -180,7 +180,11 @@ function! SyntaxCheckers_java_GetLocList()
|
||||
" add classpathes to javac_classpath
|
||||
for path in split(g:syntastic_java_javac_classpath,"\n")
|
||||
if path != ''
|
||||
let ps = glob(path,0,1)
|
||||
try
|
||||
let ps = glob(path,0,1)
|
||||
catch
|
||||
let ps = split(glob(path,0),"\n")
|
||||
endtry
|
||||
if type(ps) == type([])
|
||||
for p in ps
|
||||
if p != '' | let javac_classpath = s:AddToClasspath(javac_classpath,p) | endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
"============================================================================
|
||||
"File: objc.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"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
|
||||
@ -10,146 +10,19 @@
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" In order to also check header files add this to your .vimrc:
|
||||
" (this usually creates a .gch file in your source directory)
|
||||
"
|
||||
" let g:syntastic_objc_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_objc_no_include_search = 1
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_objc_includes. Then the header files are being re-checked on
|
||||
" the next file write.
|
||||
"
|
||||
" let g:syntastic_objc_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_objc_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_objc_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" In order to add some custom include directories that should be added to the
|
||||
" gcc command line you can add those to the global variable
|
||||
" g:syntastic_objc_include_dirs. This list can be used like this:
|
||||
"
|
||||
" let g:syntastic_objc_include_dirs = [ 'includes', 'headers' ]
|
||||
"
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_objc_compiler_options':
|
||||
"
|
||||
" let g:syntastic_objc_compiler_options = ' -ansi'
|
||||
"
|
||||
" Additionally the setting 'g:syntastic_objc_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_objc_config':
|
||||
"
|
||||
" let g:syntastic_objc_config_file = '.config'
|
||||
"
|
||||
" Using the global variable 'g:syntastic_objc_remove_include_errors' you can
|
||||
" specify whether errors of files included via the g:syntastic_objc_include_dirs'
|
||||
" setting are removed from the result set:
|
||||
"
|
||||
" let g:syntastic_objc_remove_include_errors = 1
|
||||
"
|
||||
" Use the variable 'g:syntastic_objc_errorformat' to override the default error
|
||||
" format:
|
||||
"
|
||||
" let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m'
|
||||
|
||||
if !executable('gcc')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:syntastic_objc_compiler_options')
|
||||
let g:syntastic_objc_compiler_options = ''
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_objc_config_file')
|
||||
let g:syntastic_objc_config_file = '.syntastic_objc_config'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_objc_GetLocList()
|
||||
let makeprg = 'gcc -fsyntax-only -lobjc'
|
||||
let errorformat =
|
||||
\ '%-G%f:%s:,'.
|
||||
\ '%f:%l:%c: %trror: %m,'.
|
||||
\ '%f:%l:%c: %tarning: %m,'.
|
||||
\ '%f:%l:%c: %m,'.
|
||||
\ '%f:%l: %trror: %m,'.
|
||||
\ '%f:%l: %tarning: %m,'.
|
||||
\ '%f:%l: %m'
|
||||
|
||||
if exists('g:syntastic_objc_errorformat')
|
||||
let errorformat = g:syntastic_objc_errorformat
|
||||
endif
|
||||
|
||||
" add optional user-defined compiler options
|
||||
let makeprg .= g:syntastic_objc_compiler_options
|
||||
|
||||
let makeprg .= ' '.shellescape(expand('%')).
|
||||
\ ' '.syntastic#c#GetIncludeDirs('c')
|
||||
|
||||
" determine whether to parse header files as well
|
||||
if expand('%') =~? '.h$'
|
||||
if exists('g:syntastic_objc_check_header')
|
||||
let makeprg = 'gcc -c '.shellescape(expand('%')).
|
||||
\ ' '.syntastic#c#GetIncludeDirs('c')
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
" check if the user manually set some cflags
|
||||
if !exists('b:syntastic_objc_cflags')
|
||||
" check whether to search for include files at all
|
||||
if !exists('g:syntastic_objc_no_include_search') ||
|
||||
\ g:syntastic_objc_no_include_search != 1
|
||||
" refresh the include file search if desired
|
||||
if exists('g:syntastic_objc_auto_refresh_includes') &&
|
||||
\ g:syntastic_objc_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#c#SearchHeaders()
|
||||
else
|
||||
" search for header includes if not cached already
|
||||
if !exists('b:syntastic_objc_includes')
|
||||
let b:syntastic_objc_includes = syntastic#c#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_objc_includes
|
||||
endif
|
||||
endif
|
||||
if !exists('g:syntastic_objc_checker')
|
||||
if exists('g:loaded_youcompleteme')
|
||||
let g:syntastic_objc_checker = "ycm"
|
||||
else
|
||||
" use the user-defined cflags
|
||||
let makeprg .= b:syntastic_objc_cflags
|
||||
let g:syntastic_objc_checker = "gcc"
|
||||
endif
|
||||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let makeprg .= ' '.syntastic#c#ReadConfig(g:syntastic_objc_config_file)
|
||||
|
||||
" process makeprg
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
|
||||
" filter the processed errors if desired
|
||||
if exists('g:syntastic_objc_remove_include_errors') &&
|
||||
\ g:syntastic_objc_remove_include_errors != 0
|
||||
return filter(errors,
|
||||
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
|
||||
else
|
||||
return errors
|
||||
if g:syntastic_objc_checker == "ycm"
|
||||
runtime! syntax_checkers/objc/ycm.vim
|
||||
elseif g:syntastic_objc_checker == "gcc" || g:syntastic_objc_checker == "clang"
|
||||
if executable(g:syntastic_objc_checker)
|
||||
runtime! syntax_checkers/objc/gcc.vim
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
|
155
syntax_checkers/objc/gcc.vim
Normal file
155
syntax_checkers/objc/gcc.vim
Normal file
@ -0,0 +1,155 @@
|
||||
"============================================================================
|
||||
"File: objc.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
||||
"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.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
" In order to also check header files add this to your .vimrc:
|
||||
" (this usually creates a .gch file in your source directory)
|
||||
"
|
||||
" let g:syntastic_objc_check_header = 1
|
||||
"
|
||||
" To disable the search of included header files after special
|
||||
" libraries like gtk and glib add this line to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_objc_no_include_search = 1
|
||||
"
|
||||
" To enable header files being re-checked on every file write add the
|
||||
" following line to your .vimrc. Otherwise the header files are checked only
|
||||
" one time on initially loading the file.
|
||||
" In order to force syntastic to refresh the header includes simply
|
||||
" unlet b:syntastic_objc_includes. Then the header files are being re-checked on
|
||||
" the next file write.
|
||||
"
|
||||
" let g:syntastic_objc_auto_refresh_includes = 1
|
||||
"
|
||||
" Alternatively you can set the buffer local variable b:syntastic_objc_cflags.
|
||||
" If this variable is set for the current buffer no search for additional
|
||||
" libraries is done. I.e. set the variable like this:
|
||||
"
|
||||
" let b:syntastic_objc_cflags = ' -I/usr/include/libsoup-2.4'
|
||||
"
|
||||
" In order to add some custom include directories that should be added to the
|
||||
" gcc command line you can add those to the global variable
|
||||
" g:syntastic_objc_include_dirs. This list can be used like this:
|
||||
"
|
||||
" let g:syntastic_objc_include_dirs = [ 'includes', 'headers' ]
|
||||
"
|
||||
" Moreover it is possible to add additional compiler options to the syntax
|
||||
" checking execution via the variable 'g:syntastic_objc_compiler_options':
|
||||
"
|
||||
" let g:syntastic_objc_compiler_options = ' -ansi'
|
||||
"
|
||||
" Additionally the setting 'g:syntastic_objc_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_objc_config':
|
||||
"
|
||||
" let g:syntastic_objc_config_file = '.config'
|
||||
"
|
||||
" Using the global variable 'g:syntastic_objc_remove_include_errors' you can
|
||||
" specify whether errors of files included via the g:syntastic_objc_include_dirs'
|
||||
" setting are removed from the result set:
|
||||
"
|
||||
" let g:syntastic_objc_remove_include_errors = 1
|
||||
"
|
||||
" Use the variable 'g:syntastic_objc_errorformat' to override the default error
|
||||
" format:
|
||||
"
|
||||
" let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m'
|
||||
|
||||
if !executable('gcc')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:syntastic_objc_compiler_options')
|
||||
let g:syntastic_objc_compiler_options = ''
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_objc_config_file')
|
||||
let g:syntastic_objc_config_file = '.syntastic_objc_config'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_objc_GetLocList()
|
||||
let makeprg = 'gcc -fsyntax-only -lobjc'
|
||||
let errorformat =
|
||||
\ '%-G%f:%s:,'.
|
||||
\ '%f:%l:%c: %trror: %m,'.
|
||||
\ '%f:%l:%c: %tarning: %m,'.
|
||||
\ '%f:%l:%c: %m,'.
|
||||
\ '%f:%l: %trror: %m,'.
|
||||
\ '%f:%l: %tarning: %m,'.
|
||||
\ '%f:%l: %m'
|
||||
|
||||
if exists('g:syntastic_objc_errorformat')
|
||||
let errorformat = g:syntastic_objc_errorformat
|
||||
endif
|
||||
|
||||
" add optional user-defined compiler options
|
||||
let makeprg .= g:syntastic_objc_compiler_options
|
||||
|
||||
let makeprg .= ' '.shellescape(expand('%')).
|
||||
\ ' '.syntastic#c#GetIncludeDirs('c')
|
||||
|
||||
" determine whether to parse header files as well
|
||||
if expand('%') =~? '.h$'
|
||||
if exists('g:syntastic_objc_check_header')
|
||||
let makeprg = 'gcc -c '.shellescape(expand('%')).
|
||||
\ ' '.syntastic#c#GetIncludeDirs('c')
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
" check if the user manually set some cflags
|
||||
if !exists('b:syntastic_objc_cflags')
|
||||
" check whether to search for include files at all
|
||||
if !exists('g:syntastic_objc_no_include_search') ||
|
||||
\ g:syntastic_objc_no_include_search != 1
|
||||
" refresh the include file search if desired
|
||||
if exists('g:syntastic_objc_auto_refresh_includes') &&
|
||||
\ g:syntastic_objc_auto_refresh_includes != 0
|
||||
let makeprg .= syntastic#c#SearchHeaders()
|
||||
else
|
||||
" search for header includes if not cached already
|
||||
if !exists('b:syntastic_objc_includes')
|
||||
let b:syntastic_objc_includes = syntastic#c#SearchHeaders()
|
||||
endif
|
||||
let makeprg .= b:syntastic_objc_includes
|
||||
endif
|
||||
endif
|
||||
else
|
||||
" use the user-defined cflags
|
||||
let makeprg .= b:syntastic_objc_cflags
|
||||
endif
|
||||
|
||||
" add optional config file parameters
|
||||
let makeprg .= ' '.syntastic#c#ReadConfig(g:syntastic_objc_config_file)
|
||||
|
||||
" process makeprg
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
|
||||
" filter the processed errors if desired
|
||||
if exists('g:syntastic_objc_remove_include_errors') &&
|
||||
\ g:syntastic_objc_remove_include_errors != 0
|
||||
return filter(errors,
|
||||
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
|
||||
else
|
||||
return errors
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
25
syntax_checkers/objc/ycm.vim
Normal file
25
syntax_checkers/objc/ycm.vim
Normal file
@ -0,0 +1,25 @@
|
||||
"============================================================================
|
||||
"File: ycm.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.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("loaded_ycm_objc_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_ycm_objc_syntax_checker = 1
|
||||
|
||||
if !exists('g:loaded_youcompleteme')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_objc_GetLocList()
|
||||
return youcompleteme#CurrentFileDiagnostics()
|
||||
endfunction
|
||||
|
27
syntax_checkers/objcpp.vim
Normal file
27
syntax_checkers/objcpp.vim
Normal 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
|
@ -89,8 +89,8 @@ endfunction
|
||||
function! s:GetPHPMDErrors()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'phpmd',
|
||||
\ 'args': 'text ' . g:syntastic_phpmd_rules,
|
||||
\ 'subchecker': 'phpcs' })
|
||||
\ 'post_args': 'text ' . g:syntastic_phpmd_rules,
|
||||
\ 'subchecker': 'phpmd' })
|
||||
let errorformat = '%E%f:%l%m'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype' : 'Style' })
|
||||
endfunction
|
||||
|
22
syntax_checkers/twig.vim
Normal file
22
syntax_checkers/twig.vim
Normal file
@ -0,0 +1,22 @@
|
||||
"============================================================================
|
||||
"File: twig.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Alexander <iam.asm89 at gmail dot com>
|
||||
"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.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
function! SyntaxCheckers_twig_GetHighlightRegex(item)
|
||||
" Let's match the full line for now
|
||||
return '\V'
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_twig_GetLocList()
|
||||
let makeprg = "twig-lint lint --format=csv ".shellescape(expand('%'))
|
||||
let errorformat = '"%f"\,%l\,%m'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat})
|
||||
endfunction
|
Loading…
x
Reference in New Issue
Block a user