1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-18 12:00:30 +01:00

Update of CtrlP, Syntastic, Tagbar, Taglisttoo, and Mark plugins

This commit is contained in:
2012-09-20 18:57:57 +02:00
parent 71a1d914e0
commit b033e2bb39
44 changed files with 1987 additions and 994 deletions

View File

@@ -50,12 +50,44 @@ enabled.
Installation
------------
[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install syntastic.
Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already
have pathogen working then skip Step 1 and go to Step 2.
Step 1: Install pathogen.vim
----------------------------
First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) so that
it's easy to install syntastic. Do this in your Terminal so that you get the pathogen.vim file
and the directories it needs:
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
Next you *need to add this* to your ~/.vimrc:
call pathogen#infect()
Step 2: Install syntastic as a pathogen bundle
----------------------------------------------
You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
Then reload vim, run `:Helptags`, and check out `:help syntastic.txt`.
Quit vim and start it back up to reload it, then type:
:Helptags
If you get an error when you do this, then you probably didn't install pathogen right. Go back to
step 1 and make sure you did the following:
1. Created both the ~/.vim/autoload and ~/.vim/bundle directories.
2. Added the "call pathogen#infect()" line to your ~/.vimrc file
3. Did the git clone of syntastic inside ~/.vim/bundle
4. Have permissions to access all of these directories.
Google group
@@ -69,10 +101,15 @@ FAQ
__Q. I installed syntastic but it isn't reporting any errors ...__
A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/<filetype>.vim`.
A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/<filetype>.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay.
Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request.
__Q. How can I jump between the different errors without using the location list at the bottom of the window?__
A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`.
If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired) - which provides such mappings (among other things).
Changelog
---------

View File

@@ -163,6 +163,20 @@ syntax errors: >
let g:syntastic_enable_signs=1
<
*'syntastic_error_symbol'* *'syntastic_style_error_symbol'*
*'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'*
Use this option to control what the syntastic |:sign| text contains. Several
error symobls can be customized:
syntastic_error_symbol - For syntax errors, defaults to '>>'
syntastic_style_error_symbol - For style errors, defaults to 'S>'
syntastic_warning_symbol - For syntax warnings, defaults to '>>'
syntastic_style_warning_symbol - For style warnings, defaults to 'S>'
Example: >
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
<
*'syntastic_enable_balloons'*
Default: 1
Use this option to tell syntastic whether to display error messages in balloons
@@ -340,7 +354,7 @@ The author of syntastic is a mighty wild stallion, hear him roar! >
<
He likes to trot around in the back yard reading his emails and sipping a
scolding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
scalding hot cup of Earl Grey. Email him at martin.grenfell at gmail dot com.
He can also be found trolling the #vim channel on the freenode IRC network as
scrooloose.

View File

@@ -26,6 +26,23 @@ endif
if !exists("g:syntastic_enable_signs")
let g:syntastic_enable_signs = 1
endif
if !exists("g:syntastic_error_symbol")
let g:syntastic_error_symbol = '>>'
endif
if !exists("g:syntastic_warning_symbol")
let g:syntastic_warning_symbol = '>>'
endif
if !exists("g:syntastic_style_error_symbol")
let g:syntastic_style_error_symbol = 'S>'
endif
if !exists("g:syntastic_style_warning_symbol")
let g:syntastic_style_warning_symbol = 'S>'
endif
if !has('signs')
let g:syntastic_enable_signs = 0
endif
@@ -115,9 +132,7 @@ function! s:UpdateErrors(auto_invoked)
call s:CacheErrors()
end
if s:BufHasErrorsOrWarningsToDisplay()
call setloclist(0, s:LocList())
endif
call setloclist(0, s:LocList())
if g:syntastic_enable_balloons
call s:RefreshBalloons()
@@ -183,7 +198,7 @@ function! s:CacheErrors()
"functions legally for filetypes like "gentoo-metadata"
let fts = substitute(&ft, '-', '_', 'g')
for ft in split(fts, '\.')
if s:Checkable(ft)
if SyntasticCheckable(ft)
let errors = SyntaxCheckers_{ft}_GetLocList()
"keep only lines that effectively match an error/warning
let errors = s:FilterLocList({'valid': 1}, errors)
@@ -226,7 +241,10 @@ function! s:ModeMapAllowsAutoChecking()
endfunction
function! s:BufHasErrorsOrWarningsToDisplay()
return len(s:Errors()) || (!g:syntastic_quiet_warnings && !empty(s:LocList()))
if empty(s:LocList())
return 0
endif
return len(s:Errors()) || !g:syntastic_quiet_warnings
endfunction
function! s:Errors()
@@ -274,10 +292,10 @@ endfunction
if g:syntastic_enable_signs
"define the signs used to display syntax and style errors/warns
sign define SyntasticError text=>> texthl=error
sign define SyntasticWarning text=>> texthl=todo
sign define SyntasticStyleError text=S> texthl=error
sign define SyntasticStyleWarning text=S> texthl=todo
exe 'sign define SyntasticError text='.g:syntastic_error_symbol.' texthl=error'
exe 'sign define SyntasticWarning text='.g:syntastic_warning_symbol.' texthl=todo'
exe 'sign define SyntasticStyleError text='.g:syntastic_style_error_symbol.' texthl=error'
exe 'sign define SyntasticStyleWarning text='.g:syntastic_style_warning_symbol.' texthl=todo'
endif
"start counting sign ids at 5000, start here to hopefully avoid conflicting
@@ -348,6 +366,7 @@ endfunction
"display the cached errors for this buf in the location list
function! s:ShowLocList()
if !empty(s:LocList())
call setloclist(0, s:LocList())
let num = winnr()
exec "lopen " . g:syntastic_loc_list_height
if num != winnr()
@@ -402,16 +421,6 @@ function! s:ClearErrorHighlights()
endfor
endfunction
"check if a syntax checker exists for the given filetype - and attempt to
"load one
function! s:Checkable(ft)
if !exists("g:loaded_" . a:ft . "_syntax_checker")
exec "runtime syntax_checkers/" . a:ft . ".vim"
endif
return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction
"set up error ballons for the current set of errors
function! s:RefreshBalloons()
let b:syntastic_balloons = {}
@@ -472,6 +481,25 @@ function! s:LoadChecker(checker, ft)
exec "runtime syntax_checkers/" . a:ft . "/" . a:checker . ".vim"
endfunction
"the script changes &shellpipe and &shell to stop the screen flicking when
"shelling out to syntax checkers. Not all OSs support the hacks though
function! s:OSSupportsShellpipeHack()
if !exists("s:os_supports_shellpipe_hack")
let s:os_supports_shellpipe_hack = !s:running_windows && (s:uname !~ "FreeBSD") && (s:uname !~ "OpenBSD")
endif
return s:os_supports_shellpipe_hack
endfunction
"check if a syntax checker exists for the given filetype - and attempt to
"load one
function! SyntasticCheckable(ft)
if !exists("g:loaded_" . a:ft . "_syntax_checker")
exec "runtime syntax_checkers/" . a:ft . ".vim"
endif
return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction
"return a string representing the state of buffer according to
"g:syntastic_stl_format
"
@@ -536,7 +564,7 @@ function! SyntasticMake(options)
let old_shell = &shell
let old_errorformat = &l:errorformat
if !s:running_windows && (s:uname !~ "FreeBSD")
if s:OSSupportsShellpipeHack()
"this is a hack to stop the screen needing to be ':redraw'n when
"when :lmake is run. Otherwise the screen flickers annoyingly
let &shellpipe='&>'
@@ -560,7 +588,7 @@ function! SyntasticMake(options)
let &shellpipe=old_shellpipe
let &shell=old_shell
if !s:running_windows && s:uname =~ "FreeBSD"
if s:OSSupportsShellpipeHack()
redraw!
endif
@@ -613,7 +641,7 @@ function! SyntasticLoadChecker(checkers, ft)
if exists(opt_name)
let opt_val = {opt_name}
if index(a:checkers, opt_val) != -1 && executable(opt_val)
if index(a:checkers, opt_val) != -1
call s:LoadChecker(opt_val, a:ft)
else
echoerr &ft . " syntax not supported or not installed."

View File

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

View File

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

View File

@@ -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 []

View File

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

View File

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

View File

@@ -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:

View File

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

View File

@@ -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 })

View File

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

View File

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

View File

@@ -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 })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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")