mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 03:50:30 +01:00
Update of CtrlP, Syntastic, Tagbar, Taglisttoo, and Mark plugins
This commit is contained in:
@@ -58,6 +58,11 @@
|
||||
" setting are removed from the result set:
|
||||
"
|
||||
" let g:syntastic_c_remove_include_errors = 1
|
||||
"
|
||||
" Use the variable 'g:syntastic_c_errorformat' to override the default error
|
||||
" format:
|
||||
"
|
||||
" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m'
|
||||
|
||||
if exists('loaded_c_syntax_checker')
|
||||
finish
|
||||
@@ -84,7 +89,13 @@ function! SyntaxCheckers_c_GetLocList()
|
||||
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
|
||||
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
|
||||
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
|
||||
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
|
||||
\ '%-G %#from %f:%l\,,%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_c_errorformat')
|
||||
let errorformat = g:syntastic_c_errorformat
|
||||
endif
|
||||
|
||||
" add optional user-defined compiler options
|
||||
let makeprg .= g:syntastic_c_compiler_options
|
||||
|
||||
@@ -19,9 +19,31 @@ if !executable("coffee")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_coffee_lint_options')
|
||||
let g:syntastic_coffee_lint_options = ""
|
||||
endif
|
||||
|
||||
|
||||
function! SyntaxCheckers_coffee_GetLocList()
|
||||
let makeprg = 'coffee -c -l -o /tmp '.shellescape(expand('%'))
|
||||
let errorformat = 'Syntax%trror: In %f\, %m on line %l,%EError: In %f\, Parse error on line %l: %m,%EError: In %f\, %m on line %l,%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
let coffee_results = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
if !empty(coffee_results)
|
||||
return coffee_results
|
||||
endif
|
||||
|
||||
if executable("coffeelint")
|
||||
return s:GetCoffeeLintErrors()
|
||||
endif
|
||||
|
||||
return []
|
||||
endfunction
|
||||
|
||||
function s:GetCoffeeLintErrors()
|
||||
let coffeelint = 'coffeelint --csv '.g:syntastic_coffee_lint_options.' '.shellescape(expand('%'))
|
||||
let lint_results = SyntasticMake({ 'makeprg': coffeelint, 'errorformat': '%f\,%l\,%trror\,%m', 'subtype': 'Style' })
|
||||
|
||||
return lint_results
|
||||
endfunction
|
||||
|
||||
@@ -58,13 +58,26 @@
|
||||
" 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('loaded_cpp_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
let loaded_cpp_syntax_checker = 1
|
||||
|
||||
if !executable('g++')
|
||||
if !exists('g:syntastic_cpp_compiler')
|
||||
let g:syntastic_cpp_compiler = 'g++'
|
||||
endif
|
||||
|
||||
if !executable(g:syntastic_cpp_compiler)
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -76,8 +89,14 @@ if !exists('g:syntastic_cpp_config_file')
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_cpp_GetLocList()
|
||||
let makeprg = 'g++ -fsyntax-only '
|
||||
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
|
||||
let makeprg = g:syntastic_cpp_compiler . ' -fsyntax-only '
|
||||
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
|
||||
|
||||
if exists('g:syntastic_cpp_compiler_options')
|
||||
let makeprg .= g:syntastic_cpp_compiler_options
|
||||
@@ -88,7 +107,7 @@ function! SyntaxCheckers_cpp_GetLocList()
|
||||
|
||||
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
|
||||
if exists('g:syntastic_cpp_check_header')
|
||||
let makeprg = 'g++ -c '.shellescape(expand('%')).
|
||||
let makeprg = g:syntastic_cpp_compiler.' -c '.shellescape(expand('%')).
|
||||
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
|
||||
else
|
||||
return []
|
||||
|
||||
@@ -8,18 +8,29 @@
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"============================================================================
|
||||
"
|
||||
" Specify additional options to csslint with this option. e.g. to disable
|
||||
" warnings:
|
||||
"
|
||||
" let g:syntastic_csslint_options = "--warnings=none"
|
||||
|
||||
if exists("loaded_css_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
let loaded_css_syntax_checker = 1
|
||||
|
||||
if !exists('g:syntastic_csslint_options')
|
||||
let g:syntastic_csslint_options = ""
|
||||
endif
|
||||
|
||||
" Bail if the user doesn't have `csslint` installed.
|
||||
if !executable("csslint")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_css_GetLocList()
|
||||
let makeprg = 'csslint --format=compact '.shellescape(expand('%'))
|
||||
let makeprg = 'csslint --format=compact '.g:syntastic_csslint_options.' '.
|
||||
\ shellescape(expand('%'))
|
||||
|
||||
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
|
||||
let errorformat = '%-G,%-G%f: lint free!,%f: line %l\, col %c\, %trror - %m,%f: line %l\, col %c\, %tarning - %m,%f: line %l\, col %c\, %m,'
|
||||
|
||||
@@ -11,6 +11,13 @@
|
||||
"
|
||||
" let g:syntastic_cuda_check_header = 1
|
||||
|
||||
" By default, nvcc and thus syntastic, defaults to the most basic architecture.
|
||||
" This can produce false errors if the developer intends to compile for newer
|
||||
" hardware and use newer features, eg. double precision numbers. To pass a
|
||||
" specific target arch to nvcc, e.g. add the following to your .vimrc:
|
||||
"
|
||||
" let g:syntastic_cuda_arch = "sm_20"
|
||||
|
||||
if exists('loaded_cuda_syntax_checker')
|
||||
finish
|
||||
endif
|
||||
@@ -21,13 +28,18 @@ if !executable('nvcc')
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_cuda_GetLocList()
|
||||
let makeprg = 'nvcc --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
|
||||
if exists('g:syntastic_cuda_arch')
|
||||
let arch_flag = '-arch='.g:syntastic_cuda_arch
|
||||
else
|
||||
let arch_flag = ''
|
||||
endif
|
||||
let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
|
||||
"let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
|
||||
let errorformat = '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f'',%X%*\a[%*\d]: Leaving directory `%f'',%D%*\a: Entering directory `%f'',%X%*\a: Leaving directory `%f'',%DMaking %*\a in %f,%f|%l| %m'
|
||||
|
||||
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
|
||||
if exists('g:syntastic_cuda_check_header')
|
||||
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
|
||||
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc '.arch_flag.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
|
||||
else
|
||||
return []
|
||||
endif
|
||||
|
||||
@@ -70,11 +70,11 @@
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
|
||||
use vars qw/$opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
|
||||
use vars qw/$opt_I $opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
|
||||
|
||||
use constant VERSION => 0.2;
|
||||
|
||||
getopts('cwf:h');
|
||||
getopts('cwf:hI:');
|
||||
|
||||
&usage if $opt_h; # not necessarily needed, but good for further extension
|
||||
|
||||
@@ -92,13 +92,13 @@ my $handle = (defined $opt_f ? \*FILE : \*STDOUT);
|
||||
(my $file = shift) or &usage; # display usage if no filename is supplied
|
||||
my $args = (@ARGV ? ' ' . join ' ', @ARGV : '');
|
||||
|
||||
my @error_lines = `perl @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`;
|
||||
my @error_lines = `perl @{[defined $opt_I ? "-I$opt_I" : '']} @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`;
|
||||
|
||||
my @lines = map { "E:$_" } @error_lines;
|
||||
|
||||
my @warn_lines;
|
||||
if(defined($opt_w)) {
|
||||
@warn_lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
|
||||
@warn_lines = `perl @{[defined $opt_I ? $opt_I : '']} @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
|
||||
}
|
||||
|
||||
# Any new errors must be warnings
|
||||
@@ -114,7 +114,7 @@ foreach my $line (@lines) {
|
||||
chomp($line);
|
||||
my ($file, $lineno, $message, $rest, $severity);
|
||||
|
||||
if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) {
|
||||
if ($line =~ /^([EW]):(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) {
|
||||
($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5);
|
||||
$errors++;
|
||||
$message .= $rest if ($rest =~ s/^,//);
|
||||
@@ -153,6 +153,7 @@ Usage:
|
||||
-c compile only, don't run (executes 'perl -c')
|
||||
-w output warnings as warnings instead of errors (slightly slower)
|
||||
-f write errors to <errorfile>
|
||||
-I specify \@INC/#include directory <perl_lib_path>
|
||||
|
||||
Examples:
|
||||
* At the command line:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_go_GetLocList()
|
||||
let makeprg = 'go build -o /dev/null'
|
||||
let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#'
|
||||
let errorformat = '%f:%l:%c:%m,%E%f:%l:%m,%C%m,%-G#%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
@@ -50,7 +50,7 @@ endfunction
|
||||
|
||||
function! SyntaxCheckers_html_GetLocList()
|
||||
let encopt = s:TidyEncOptByFenc()
|
||||
let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1"
|
||||
let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1"
|
||||
let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#'
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
|
||||
@@ -19,5 +19,5 @@ if exists("loaded_javascript_syntax_checker")
|
||||
endif
|
||||
let loaded_javascript_syntax_checker = 1
|
||||
|
||||
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"]
|
||||
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint", "closurecompiler"]
|
||||
call SyntasticLoadChecker(s:supported_checkers, 'javascript')
|
||||
|
||||
@@ -10,6 +10,20 @@
|
||||
"
|
||||
"============================================================================
|
||||
"
|
||||
" The more reliable way to check for a single .ml file is to use ocamlc.
|
||||
" You can do that setting this in your .vimrc:
|
||||
"
|
||||
" let g:syntastic_ocaml_use_ocamlc = 1
|
||||
" It's possible to use ocamlc in conjuction with Jane Street's Core. In order
|
||||
" to do that, you have to specify this in your .vimrc:
|
||||
"
|
||||
" let g:syntastic_ocaml_use_janestreet_core = 1
|
||||
" let g:syntastic_ocaml_janestreet_core_dir = <path>
|
||||
"
|
||||
" Where path is the path to your core installation (usually a collection of
|
||||
" .cmx and .cmxa files).
|
||||
"
|
||||
"
|
||||
" By default the camlp4o preprocessor is used to check the syntax of .ml, and .mli files,
|
||||
" ocamllex is used to check .mll files and menhir is used to check .mly files.
|
||||
" The output is all redirected to /dev/null, nothing is written to the disk.
|
||||
@@ -51,30 +65,24 @@ if !executable(s:ocamlpp)
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc')
|
||||
let g:syntastic_ocaml_use_ocamlc = 0
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_use_janestreet_core')
|
||||
let g:syntastic_ocaml_use_ocamlc = 0
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild")
|
||||
let g:syntastic_ocaml_use_ocamlbuild = 0
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_ocaml_GetLocList()
|
||||
if exists('g:syntastic_ocaml_use_ocamlbuild') &&
|
||||
\ g:syntastic_ocaml_use_ocamlbuild != 0 &&
|
||||
\ executable("ocamlbuild") &&
|
||||
\ isdirectory('_build')
|
||||
let makeprg = "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ".
|
||||
\ shellescape(expand('%:r')).".cmi"
|
||||
else
|
||||
let extension = expand('%:e')
|
||||
if match(extension, 'mly') >= 0
|
||||
" ocamlyacc output can't be redirected, so use menhir
|
||||
if !executable("menhir")
|
||||
return []
|
||||
endif
|
||||
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null"
|
||||
elseif match(extension,'mll') >= 0
|
||||
if !executable("ocamllex")
|
||||
return []
|
||||
endif
|
||||
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%'))
|
||||
endif
|
||||
let makeprg = s:GetMakeprg()
|
||||
if makeprg == ""
|
||||
return []
|
||||
endif
|
||||
|
||||
let errorformat = '%AFile "%f"\, line %l\, characters %c-%*\d:,'.
|
||||
\ '%AFile "%f"\, line %l\, characters %c-%*\d (end at line %*\d\, character %*\d):,'.
|
||||
\ '%AFile "%f"\, line %l\, character %c:,'.
|
||||
@@ -87,3 +95,51 @@ function! SyntaxCheckers_ocaml_GetLocList()
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
function s:GetMakeprg()
|
||||
if g:syntastic_ocaml_use_ocamlc
|
||||
return s:GetOcamlcMakeprg()
|
||||
endif
|
||||
|
||||
if g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')
|
||||
return s:GetOcamlBuildMakeprg()
|
||||
endif
|
||||
|
||||
return s:GetOtherMakeprg()
|
||||
endfunction
|
||||
|
||||
function s:GetOcamlcMakeprg()
|
||||
if g:syntastic_ocaml_use_janestreet_core
|
||||
let build_cmd = "ocamlc -I "
|
||||
let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir)
|
||||
let build_cmd .= " -c ".expand('%')
|
||||
return build_cmd
|
||||
else
|
||||
return "ocamlc -c ". expand('%')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function s:GetOcamlBuildMakeprg()
|
||||
return "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ".
|
||||
\ shellescape(expand('%:r')).".cmi"
|
||||
endfunction
|
||||
|
||||
function s:GetOtherMakeprg()
|
||||
"TODO: give this function a better name?
|
||||
"
|
||||
"TODO: should use throw/catch instead of returning an empty makeprg
|
||||
|
||||
let extension = expand('%:e')
|
||||
let makeprg = ""
|
||||
|
||||
if match(extension, 'mly') >= 0 && executable("menhir")
|
||||
" ocamlyacc output can't be redirected, so use menhir
|
||||
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null"
|
||||
elseif match(extension,'mll') >= 0 && executable("ocamllex")
|
||||
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%'))
|
||||
endif
|
||||
|
||||
return makeprg
|
||||
endfunction
|
||||
|
||||
@@ -10,6 +10,20 @@
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
"
|
||||
" In order to add some custom lib directories that should be added to the
|
||||
" perl command line you can add those to the global variable
|
||||
" g:syntastic_perl_lib_path.
|
||||
"
|
||||
" let g:syntastic_perl_lib_path = './lib'
|
||||
"
|
||||
" To use your own perl error output munger script, use the
|
||||
" g:syntastic_perl_efm_program option. Any command line parameters should be
|
||||
" included in the variable declaration. The program should expect a single
|
||||
" parameter; the fully qualified filename of the file to be checked.
|
||||
"
|
||||
" let g:syntastic_perl_efm_program = "foo.pl -o -m -g"
|
||||
"
|
||||
if exists("loaded_perl_syntax_checker")
|
||||
finish
|
||||
endif
|
||||
@@ -20,11 +34,16 @@ if !executable("perl")
|
||||
finish
|
||||
endif
|
||||
|
||||
"remove '-w' switch to change all warnings to errors
|
||||
let s:checker = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c -w'
|
||||
if !exists("g:syntastic_perl_efm_program")
|
||||
let g:syntastic_perl_efm_program = 'perl ' . shellescape(expand('<sfile>:p:h') . '/efm_perl.pl') . ' -c -w'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_perl_GetLocList()
|
||||
let makeprg = s:checker . ' ' . shellescape(expand('%'))
|
||||
if exists("g:syntastic_perl_lib_path")
|
||||
let makeprg = g:syntastic_perl_efm_program . ' -I' . g:syntastic_perl_lib_path . ' ' . shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = g:syntastic_perl_efm_program . ' ' . shellescape(expand('%'))
|
||||
endif
|
||||
let errorformat = '%t:%f:%l:%m'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
@@ -19,6 +19,10 @@ if !executable("puppet")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:syntastic_puppet_validate_disable")
|
||||
let g:syntastic_puppet_validate_disable = 0
|
||||
endif
|
||||
|
||||
if !exists("g:syntastic_puppet_lint_disable")
|
||||
let g:syntastic_puppet_lint_disable = 0
|
||||
endif
|
||||
@@ -27,25 +31,43 @@ if !executable("puppet-lint")
|
||||
let g:syntastic_puppet_lint_disable = 1
|
||||
endif
|
||||
|
||||
function! s:PuppetExtractVersion()
|
||||
let output = system("puppet --version")
|
||||
let output = substitute(output, '\n$', '', '')
|
||||
return split(output, '\.')
|
||||
function! s:PuppetVersion()
|
||||
if !exists("s:puppet_version")
|
||||
let output = system("puppet --version 2>/dev/null")
|
||||
let output = substitute(output, '\n$', '', '')
|
||||
let s:puppet_version = split(output, '\.')
|
||||
endif
|
||||
return s:puppet_version
|
||||
endfunction
|
||||
|
||||
function! s:PuppetLintExtractVersion()
|
||||
let output = system("puppet-lint --version")
|
||||
let output = substitute(output, '\n$', '', '')
|
||||
let output = substitute(output, '^puppet-lint ', '', 'i')
|
||||
return split(output, '\.')
|
||||
function! s:PuppetLintVersion()
|
||||
if !exists("s:puppet_lint_version")
|
||||
let output = system("puppet-lint --version 2>/dev/null")
|
||||
let output = substitute(output, '\n$', '', '')
|
||||
let output = substitute(output, '^puppet-lint ', '', 'i')
|
||||
let s:puppet_lint_version = split(output, '\.')
|
||||
endif
|
||||
return s:puppet_lint_version
|
||||
endfunction
|
||||
|
||||
let s:puppetVersion = s:PuppetExtractVersion()
|
||||
let s:lintVersion = s:PuppetLintExtractVersion()
|
||||
"the args must be arrays of the form [major, minor, macro]
|
||||
function s:IsVersionAtLeast(installed, required)
|
||||
if a:installed[0] != a:required[0]
|
||||
return a:installed[0] > a:required[0]
|
||||
endif
|
||||
|
||||
if !(s:lintVersion[0] >= '0' && s:lintVersion[1] >= '1' && s:lintVersion[2] >= '10')
|
||||
let g:syntastic_puppet_lint_disable = 1
|
||||
endif
|
||||
if a:installed[1] != a:required[1]
|
||||
return a:installed[1] > a:required[1]
|
||||
endif
|
||||
|
||||
return a:installed[2] >= a:required[2]
|
||||
endfunction
|
||||
|
||||
if !g:syntastic_puppet_lint_disable
|
||||
if !s:IsVersionAtLeast(s:PuppetLintVersion(), [0,1,10])
|
||||
let g:syntastic_puppet_lint_disable = 1
|
||||
endif
|
||||
end
|
||||
|
||||
function! s:getPuppetLintErrors()
|
||||
if !exists("g:syntastic_puppet_lint_arguments")
|
||||
@@ -57,15 +79,15 @@ function! s:getPuppetLintErrors()
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' })
|
||||
endfunction
|
||||
|
||||
function! s:getPuppetMakeprg()
|
||||
function! s:getPuppetMakeprg()
|
||||
"If puppet is >= version 2.7 then use the new executable
|
||||
if s:puppetVersion[0] >= '2' && s:puppetVersion[1] >= '7'
|
||||
if s:IsVersionAtLeast(s:PuppetVersion(), [2,7,0])
|
||||
let makeprg = 'puppet parser validate ' .
|
||||
\ shellescape(expand('%')) .
|
||||
\ ' --color=false'
|
||||
|
||||
"add --ignoreimport for versions < 2.7.10
|
||||
if s:puppetVersion[2] < '10'
|
||||
if s:PuppetVersion()[2] < '10'
|
||||
let makeprg .= ' --ignoreimport'
|
||||
endif
|
||||
|
||||
@@ -76,16 +98,19 @@ function! s:getPuppetMakeprg()
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_puppet_GetLocList()
|
||||
let errors = []
|
||||
|
||||
let makeprg = s:getPuppetMakeprg()
|
||||
if !g:syntastic_puppet_validate_disable
|
||||
let makeprg = s:getPuppetMakeprg()
|
||||
|
||||
"some versions of puppet (e.g. 2.7.10) output the message below if there
|
||||
"are any syntax errors
|
||||
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
|
||||
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||
"some versions of puppet (e.g. 2.7.10) output the message below if there
|
||||
"are any syntax errors
|
||||
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
|
||||
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||
|
||||
let errors = errors + SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endif
|
||||
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
if !g:syntastic_puppet_lint_disable
|
||||
let errors = errors + s:getPuppetLintErrors()
|
||||
endif
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
function! SyntaxCheckers_python_GetLocList()
|
||||
let makeprg = 'pylint '.g:syntastic_python_checker_args.' -f parseable -r n -i y ' .
|
||||
\ shellescape(expand('%')) .
|
||||
\ ' 2>&1 \| sed ''s_: \[[RC]_: \[W_''' .
|
||||
\ ' \| sed ''s_: \[[F]_:\ \[E_'''
|
||||
let errorformat = '%f:%l: [%t%n%.%#] %m,%f:%l: [%t%.%#] %m,%Z,%-GNo config%m'
|
||||
\ ' 2>&1 \| sed ''s_: \[\([RCW]\)_: \[W] \[\1_''' .
|
||||
\ ' \| sed ''s_: \[\([FE]\)_:\ \[E] \[\1_'''
|
||||
let errorformat = '%f:%l: [%t] %m,%Z,%-GNo config %m'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
@@ -18,8 +18,12 @@ if exists("loaded_ruby_syntax_checker")
|
||||
endif
|
||||
let loaded_ruby_syntax_checker = 1
|
||||
|
||||
"bail if the user doesnt have ruby installed
|
||||
if !executable("ruby")
|
||||
if !exists("g:syntastic_ruby_exec")
|
||||
let g:syntastic_ruby_exec = "ruby"
|
||||
endif
|
||||
|
||||
"bail if the user doesnt have ruby installed where they said it is
|
||||
if !executable(expand(g:syntastic_ruby_exec))
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -10,7 +10,12 @@
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_ruby_GetLocList()
|
||||
"let makeprg = ''
|
||||
"let errorformat = ''
|
||||
"return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
if has('win32')
|
||||
let makeprg = 'jruby -W1 -T1 -c '.shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = 'RUBYOPT= jruby -W1 -c '.shellescape(expand('%'))
|
||||
endif
|
||||
let errorformat = '%-GSyntax OK for %f,%ESyntaxError in %f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
@@ -10,13 +10,20 @@
|
||||
"
|
||||
"============================================================================
|
||||
function! SyntaxCheckers_ruby_GetLocList()
|
||||
" we cannot set RUBYOPT on windows like that
|
||||
if has('win32')
|
||||
let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
|
||||
else
|
||||
let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
|
||||
let makeprg = expand(g:syntastic_ruby_exec).' -w -T1 -c '.shellescape(expand('%'))
|
||||
if !has('win32')
|
||||
let makeprg = 'RUBYOPT= ' . makeprg
|
||||
endif
|
||||
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
|
||||
|
||||
"this is a hack to filter out a repeated useless warning in rspec files
|
||||
"containing lines like
|
||||
"
|
||||
" foo.should == 'bar'
|
||||
"
|
||||
"Which always generate the warning below. Note that ruby >= 1.9.3 includes
|
||||
"the word "possibly" in the warning
|
||||
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context'
|
||||
|
||||
let errorformat .= ',%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
@@ -31,22 +31,29 @@ function! s:GetShell()
|
||||
return b:shell
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_sh_GetLocList()
|
||||
if len(s:GetShell()) == 0 || !executable(s:GetShell())
|
||||
function! s:ForwardToZshChecker()
|
||||
if SyntasticCheckable('zsh')
|
||||
return SyntaxCheckers_zsh_GetLocList()
|
||||
else
|
||||
return []
|
||||
endif
|
||||
let output = split(system(s:GetShell().' -n '.shellescape(expand('%'))), '\n')
|
||||
if v:shell_error != 0
|
||||
let result = []
|
||||
for err_line in output
|
||||
let line = substitute(err_line, '^[^:]*:\D\{-}\(\d\+\):.*', '\1', '')
|
||||
let msg = substitute(err_line, '^[^:]*:\D\{-}\d\+: \(.*\)', '\1', '')
|
||||
call add(result, {'lnum' : line,
|
||||
\ 'text' : msg,
|
||||
\ 'bufnr': bufnr(''),
|
||||
\ 'type': 'E' })
|
||||
endfor
|
||||
return result
|
||||
endif
|
||||
return []
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:IsShellValid()
|
||||
return len(s:GetShell()) > 0 && executable(s:GetShell())
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_sh_GetLocList()
|
||||
if s:GetShell() == 'zsh'
|
||||
return s:ForwardToZshChecker()
|
||||
endif
|
||||
|
||||
if !s:IsShellValid()
|
||||
return []
|
||||
endif
|
||||
|
||||
let makeprg = s:GetShell() . ' -n ' . shellescape(expand('%'))
|
||||
let errorformat = '%f: line %l: %m'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat})
|
||||
endfunction
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"
|
||||
"Installation: $ npm install -g js-yaml.bin
|
||||
"Installation: $ npm install -g js-yaml
|
||||
"
|
||||
"============================================================================
|
||||
if exists("loaded_yaml_syntax_checker")
|
||||
|
||||
Reference in New Issue
Block a user