1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 19:40:29 +01:00

Fix for regexp in pylint_parseable.py script, update of the scripts:

ctrlp, syntastic, tagbar and taglisttoo
This commit is contained in:
2012-10-15 22:41:49 +02:00
parent b033e2bb39
commit 6fcf232124
21 changed files with 222 additions and 247 deletions

View File

@@ -5,7 +5,7 @@ a "make" command for VIm
""" """
import sys import sys
import re import re
from StringIO import StringIO from cStringIO import StringIO
from optparse import OptionParser from optparse import OptionParser
from pylint import lint from pylint import lint
@@ -56,7 +56,7 @@ def parsable_pylint(filename):
error_list = [] error_list = []
carriage_re = re.compile(r'\s*\^+$') carriage_re = re.compile(r'\s*\^+$')
error_re = re.compile(r'^([C,R,W,E,F].+):\s+?([0-9]+):?.*:\s(.*)$') error_re = re.compile(r'^([C,R,W,E,F].+):(\s+)?([0-9]+):?.*:\s(.*)$')
for bufline in buf: for bufline in buf:
bufline = bufline.rstrip() # remove trailing newline character bufline = bufline.rstrip() # remove trailing newline character
@@ -66,8 +66,8 @@ def parsable_pylint(filename):
error_list.append(code_line) error_list.append(code_line)
code_line = {} code_line = {}
code_line['type'], code_line['lnum'], code_line['text'] = \ (code_line['type'], _unused, code_line['lnum'],
error_re.match(bufline).groups() code_line['text']) = error_re.match(bufline).groups()
if carriage_re.match(bufline) and code_line: if carriage_re.match(bufline) and code_line:
code_line['col'] = carriage_re.match(bufline).group().find('^') + 1 code_line['col'] = carriage_re.match(bufline).group().find('^') + 1

View File

@@ -1303,8 +1303,17 @@ endf
" *** Paths {{{2 " *** Paths {{{2
" Line formatting {{{3 " Line formatting {{{3
fu! s:formatline(str) fu! s:formatline(str)
let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str) let str = a:str
retu '> '.( cond ? s:pathshorten(a:str) : a:str ) if s:itemtype == 1
let bfnr = bufnr('^'.fnamemodify(str, ':p').'$')
let idc = ( bfnr == bufnr('#') ? '#' : '' )
\ . ( getbufvar(bfnr, '&ma') ? '' : '-' )
\ . ( getbufvar(bfnr, '&ro') ? '=' : '' )
\ . ( getbufvar(bfnr, '&mod') ? '+' : '' )
let str .= idc != '' ? ' '.idc : ''
en
let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str)
retu '> '.( cond ? s:pathshorten(str) : str )
endf endf
fu! s:pathshorten(str) fu! s:pathshorten(str)

View File

@@ -1157,8 +1157,8 @@ Highlighting:~
Statuslines:~ Statuslines:~
* Highlight groups: * Highlight groups:
CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character) CtrlPMode1 : 'file' or 'path', and the current mode (Character)
CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|) CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)
CtrlPStats : the scanning status (Function) CtrlPStats : the scanning status (Function)
For rebuilding the statuslines, see |g:ctrlp_status_func|. For rebuilding the statuslines, see |g:ctrlp_status_func|.
@@ -1240,6 +1240,7 @@ Special thanks:~
* Seth Fowler <github.com/sfowler> * Seth Fowler <github.com/sfowler>
* Lowe Thiderman <github.com/thiderman> * Lowe Thiderman <github.com/thiderman>
* Christopher Fredén <github.com/icetan> * Christopher Fredén <github.com/icetan>
* Zahary Karadjov <github.com/zah>
=============================================================================== ===============================================================================
CHANGELOG *ctrlp-changelog* CHANGELOG *ctrlp-changelog*

View File

@@ -53,6 +53,17 @@ function! s:Unique(list)
return l return l
endfunction endfunction
" convenience function to determine the 'null device' parameter
" based on the current operating system
function! syntastic#c#GetNullDevice()
if has('win32')
return '-o nul'
elseif has('unix') || has('mac')
return '-o /dev/null'
endif
return ''
endfunction
" get the gcc include directory argument depending on the default " get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs' " includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! syntastic#c#GetIncludeDirs(filetype) function! syntastic#c#GetIncludeDirs(filetype)

View File

@@ -19,10 +19,6 @@ let g:loaded_syntastic_plugin = 1
let s:running_windows = has("win16") || has("win32") let s:running_windows = has("win16") || has("win32")
if !s:running_windows
let s:uname = system('uname')
endif
if !exists("g:syntastic_enable_signs") if !exists("g:syntastic_enable_signs")
let g:syntastic_enable_signs = 1 let g:syntastic_enable_signs = 1
endif endif
@@ -58,6 +54,12 @@ if !exists("g:syntastic_enable_highlighting")
let g:syntastic_enable_highlighting = 1 let g:syntastic_enable_highlighting = 1
endif endif
" highlighting requires getmatches introduced in 7.1.040
if g:syntastic_enable_highlighting == 1 &&
\ (v:version < 701 || v:version == 701 && has('patch040'))
let g:syntastic_enable_highlighting = 1
endif
if !exists("g:syntastic_echo_current_error") if !exists("g:syntastic_echo_current_error")
let g:syntastic_echo_current_error = 1 let g:syntastic_echo_current_error = 1
endif endif
@@ -143,7 +145,7 @@ function! s:UpdateErrors(auto_invoked)
endif endif
if g:syntastic_enable_highlighting if g:syntastic_enable_highlighting
call s:HightlightErrors() call s:HighlightErrors()
endif endif
if g:syntastic_auto_jump && s:BufHasErrorsOrWarningsToDisplay() if g:syntastic_auto_jump && s:BufHasErrorsOrWarningsToDisplay()
@@ -384,7 +386,7 @@ endfunction
" "
"If the 'force_highlight_callback' key is set for an error item, then invoke "If the 'force_highlight_callback' key is set for an error item, then invoke
"the callback even if it can be highlighted automatically. "the callback even if it can be highlighted automatically.
function! s:HightlightErrors() function! s:HighlightErrors()
call s:ClearErrorHighlights() call s:ClearErrorHighlights()
let fts = substitute(&ft, '-', '_', 'g') let fts = substitute(&ft, '-', '_', 'g')
@@ -485,11 +487,18 @@ endfunction
"shelling out to syntax checkers. Not all OSs support the hacks though "shelling out to syntax checkers. Not all OSs support the hacks though
function! s:OSSupportsShellpipeHack() function! s:OSSupportsShellpipeHack()
if !exists("s:os_supports_shellpipe_hack") if !exists("s:os_supports_shellpipe_hack")
let s:os_supports_shellpipe_hack = !s:running_windows && (s:uname !~ "FreeBSD") && (s:uname !~ "OpenBSD") let s:os_supports_shellpipe_hack = !s:running_windows && (s:uname() !~ "FreeBSD") && (s:uname() !~ "OpenBSD")
endif endif
return s:os_supports_shellpipe_hack return s:os_supports_shellpipe_hack
endfunction endfunction
function! s:uname()
if !exists('s:uname')
let s:uname = system('uname')
endif
return s:uname
endfunction
"check if a syntax checker exists for the given filetype - and attempt to "check if a syntax checker exists for the given filetype - and attempt to
"load one "load one
function! SyntasticCheckable(ft) function! SyntasticCheckable(ft)
@@ -500,6 +509,19 @@ function! SyntasticCheckable(ft)
return exists("*SyntaxCheckers_". a:ft ."_GetLocList") return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction endfunction
"the args must be arrays of the form [major, minor, macro]
function SyntasticIsVersionAtLeast(installed, required)
if a:installed[0] != a:required[0]
return a:installed[0] > a:required[0]
endif
if a:installed[1] != a:required[1]
return a:installed[1] > a:required[1]
endif
return a:installed[2] >= a:required[2]
endfunction
"return a string representing the state of buffer according to "return a string representing the state of buffer according to
"g:syntastic_stl_format "g:syntastic_stl_format
" "

View File

@@ -1,7 +1,7 @@
"============================================================================ "============================================================================
"File: c.vim "File: c.vim
"Description: Syntax checking plugin for syntastic.vim "Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com> "Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty, "License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute " 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 " it and/or modify it under the terms of the Do What The Fuck You
@@ -9,150 +9,31 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
" "
"============================================================================ "============================================================================
if exists("loaded_c_syntax_checker")
" 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_c_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_c_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_c_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_c_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_c_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_c_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_c_include_dirs. This list can be used like this:
"
" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_c_compiler_options':
"
" let g:syntastic_c_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_c_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_c_config':
"
" let g:syntastic_c_config_file = '.config'
"
" Using the global variable 'g:syntastic_c_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_c_include_dirs'
" 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 finish
endif endif
let loaded_c_syntax_checker = 1 let loaded_c_syntax_checker = 1
if !executable('gcc') if !exists('g:syntastic_c_checker')
finish let g:syntastic_c_checker = "gcc"
endif endif
let s:save_cpo = &cpo if g:syntastic_c_checker == "gcc"
set cpo&vim if executable("gcc")
runtime! syntax_checkers/c/gcc.vim
if !exists('g:syntastic_c_compiler_options') endif
let g:syntastic_c_compiler_options = '-std=gnu99' elseif g:syntastic_c_checker == "checkpatch"
if executable("checkpatch.pl") || executable("./scripts/checkpatch.pl")
runtime! syntax_checkers/c/checkpatch.vim
endif
elseif g:syntastic_c_checker == "checkpatch-kernel-only"
if executable("./scripts/checkpatch.pl")
runtime! syntax_checkers/c/checkpatch.vim
elseif executable("gcc")
runtime! syntax_checkers/c/gcc.vim
endif
elseif g:syntastic_c_checker == "sparse"
if executable("cgcc")
runtime! syntax_checkers/c/sparse.vim
endif
endif endif
if !exists('g:syntastic_c_config_file')
let g:syntastic_c_config_file = '.syntastic_c_config'
endif
function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only '
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: %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
let makeprg .= ' '.shellescape(expand('%')).
\ ' '.syntastic#c#GetIncludeDirs('c')
" determine whether to parse header files as well
if expand('%') =~? '.h$'
if exists('g:syntastic_c_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_c_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_c_no_include_search') ||
\ g:syntastic_c_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_c_auto_refresh_includes') &&
\ g:syntastic_c_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_c_includes')
let b:syntastic_c_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_c_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_c_cflags
endif
" add optional config file parameters
let makeprg .= ' '.syntastic#c#ReadConfig(g:syntastic_c_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_c_remove_include_errors') &&
\ g:syntastic_c_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:

View File

@@ -11,7 +11,6 @@
"============================================================================ "============================================================================
" in order to also check header files add this to your .vimrc: " 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_cpp_check_header = 1 " let g:syntastic_cpp_check_header = 1
" "
@@ -77,6 +76,10 @@ if !exists('g:syntastic_cpp_compiler')
let g:syntastic_cpp_compiler = 'g++' let g:syntastic_cpp_compiler = 'g++'
endif endif
if !exists('g:syntastic_cpp_compiler_options')
let g:syntastic_cpp_compiler_options = ''
endif
if !executable(g:syntastic_cpp_compiler) if !executable(g:syntastic_cpp_compiler)
finish finish
endif endif
@@ -89,7 +92,8 @@ if !exists('g:syntastic_cpp_config_file')
endif endif
function! SyntaxCheckers_cpp_GetLocList() function! SyntaxCheckers_cpp_GetLocList()
let makeprg = g:syntastic_cpp_compiler . ' -fsyntax-only ' let makeprg = g:syntastic_cpp_compiler . ' -fsyntax-only ' .
\ g:syntastic_cpp_compiler_options
let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '. 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,'. \ '%m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,'.
\ '%f:%l: %m' \ '%f:%l: %m'
@@ -98,16 +102,14 @@ function! SyntaxCheckers_cpp_GetLocList()
let errorformat = g:syntastic_cpp_errorformat let errorformat = g:syntastic_cpp_errorformat
endif endif
if exists('g:syntastic_cpp_compiler_options')
let makeprg .= g:syntastic_cpp_compiler_options
endif
let makeprg .= ' ' . shellescape(expand('%')) . let makeprg .= ' ' . shellescape(expand('%')) .
\ ' ' . syntastic#c#GetIncludeDirs('cpp') \ ' ' . syntastic#c#GetIncludeDirs('cpp')
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$' if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
if exists('g:syntastic_cpp_check_header') if exists('g:syntastic_cpp_check_header')
let makeprg = g:syntastic_cpp_compiler.' -c '.shellescape(expand('%')). let makeprg = g:syntastic_cpp_compiler.' -c '.shellescape(expand('%')) .
\ ' ' . g:syntastic_cpp_compiler_options .
\ ' ' . syntastic#c#GetNullDevice() .
\ ' ' . syntastic#c#GetIncludeDirs('cpp') \ ' ' . syntastic#c#GetIncludeDirs('cpp')
else else
return [] return []

View File

@@ -92,13 +92,14 @@ my $handle = (defined $opt_f ? \*FILE : \*STDOUT);
(my $file = shift) or &usage; # display usage if no filename is supplied (my $file = shift) or &usage; # display usage if no filename is supplied
my $args = (@ARGV ? ' ' . join ' ', @ARGV : ''); my $args = (@ARGV ? ' ' . join ' ', @ARGV : '');
my @error_lines = `perl @{[defined $opt_I ? "-I$opt_I" : '']} @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`; my $libs = join ' ', map {"-I$_"} split ',', $opt_I;
my @error_lines = `perl $libs @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`;
my @lines = map { "E:$_" } @error_lines; my @lines = map { "E:$_" } @error_lines;
my @warn_lines; my @warn_lines;
if(defined($opt_w)) { if(defined($opt_w)) {
@warn_lines = `perl @{[defined $opt_I ? $opt_I : '']} @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`; @warn_lines = `perl $libs @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`;
} }
# Any new errors must be warnings # Any new errors must be warnings

View File

@@ -20,6 +20,10 @@ if !executable("escript")
endif endif
let s:check_file = expand('<sfile>:p:h') . '/erlang_check_file.erl' let s:check_file = expand('<sfile>:p:h') . '/erlang_check_file.erl'
if !exists("g:syntastic_erlc_include_path")
let g:syntastic_erlc_include_path=""
endif
function! SyntaxCheckers_erlang_GetLocList() function! SyntaxCheckers_erlang_GetLocList()
let extension = expand('%:e') let extension = expand('%:e')
@@ -31,10 +35,10 @@ function! SyntaxCheckers_erlang_GetLocList()
if match(shebang, 'escript') >= 0 if match(shebang, 'escript') >= 0
let makeprg = 'escript -s '.shellescape(expand('%:p')) let makeprg = 'escript -s '.shellescape(expand('%:p'))
else else
let makeprg = s:check_file . ' '. shellescape(expand('%:p')) let makeprg = s:check_file . ' '. shellescape(expand('%:p')).' '.g:syntastic_erlc_include_path
endif endif
else else
let makeprg = s:check_file . ' ' . shellescape(expand('%:p')) let makeprg = s:check_file . ' ' . shellescape(expand('%:p')).' '.g:syntastic_erlc_include_path
endif endif
let errorformat = '%f:%l:\ %tarning:\ %m,%E%f:%l:\ %m' let errorformat = '%f:%l:\ %tarning:\ %m,%E%f:%l:\ %m'

View File

@@ -1,6 +1,10 @@
#!/usr/bin/env escript #!/usr/bin/env escript
-export([main/1]). -export([main/1]).
main([FileName| LibDirs=[_|_]]) ->
code:add_pathsa(LibDirs),
main([FileName]);
main([FileName]) -> main([FileName]) ->
compile:file(FileName, [warn_obsolete_guard, compile:file(FileName, [warn_obsolete_guard,
warn_unused_import, warn_unused_import,

View File

@@ -14,21 +14,24 @@ if exists("loaded_eruby_syntax_checker")
endif endif
let loaded_eruby_syntax_checker = 1 let loaded_eruby_syntax_checker = 1
"bail if the user doesnt have ruby or cat installed "bail if the user doesnt have ruby installed
if !executable("ruby") || !executable("cat") if !executable("ruby")
finish finish
endif endif
function! SyntaxCheckers_eruby_GetLocList() function! SyntaxCheckers_eruby_GetLocList()
"gsub fixes issue #7 rails has it's own eruby syntax
if has('win32') if has('win32')
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| ruby -c' let makeprg='ruby -rerb -e "puts ERB.new(File.read(''' .
\ (expand("%")) .
\ ''').gsub(''<\%='',''<\%''), nil, ''-'').src" \| ruby -c'
else else
let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c' let makeprg='RUBYOPT= ruby -rerb -e "puts ERB.new(File.read(''' .
\ (expand("%")) .
\ ''').gsub(''<\%='',''<\%''), nil, ''-'').src" \| RUBYOPT= ruby -c'
endif endif
let errorformat='%-GSyntax OK,%E-:%l: syntax error\, %m,%Z%p^,%W-:%l: warning: %m,%Z%p^,%-C%.%#' let errorformat='%-GSyntax OK,%E-:%l: syntax error\, %m,%Z%p^,%W-:%l: warning: %m,%Z%p^,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat})
endfunction endfunction

View File

@@ -1,28 +1,23 @@
"============================================================================ "============================================================================
"File: java.vim "File: java.vim
"Description: Syntax checking plugin for syntastic.vim "Description: Figures out which java syntax checker (if any) to load
"Maintainer: Jochen Keil <jochen.keil at gmail dot com> " from the java directory.
"Maintainer: Dmitry Geurkov <d.geurkov at gmail dot com>
"License: This program is free software. It comes without any warranty, "License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute " 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 " 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. " Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
" "
" Use g:syntastic_java_checker option to specify which java syntax checker
" should be used (see below for a list of supported checkers).
" If g:syntastic_java_checker is not set, just use the first syntax
" checker that we find installed.
"============================================================================ "============================================================================
function! SyntaxCheckers_java_GetLocList() if exists("loaded_java_syntax_checker")
finish
endif
let loaded_java_syntax_checker = 1
let makeprg = 'javac -Xlint ' let s:supported_checkers = ["javac", "checkstyle"]
\. expand ( '%:p:h' ) . '/' . expand ( '%:t' ) call SyntasticLoadChecker(s:supported_checkers, 'java')
\. ' 2>&1 \| '
\. 'sed -e "s\|'
\. expand ( '%:t' )
\. '\|'
\. expand ( '%:p:h' ) . '/' . expand ( '%:t' )
\. '\|"'
" unashamedly stolen from *errorformat-javac* (quickfix.txt)
let errorformat = '%A%f:%l:\ %m,%+Z%p^,%+C%.%#,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

View File

@@ -9,6 +9,14 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
" "
"============================================================================ "============================================================================
" To send additional options to less use the variable g:syntastic_less_options.
" The default is
" let g:syntastic_less_options = "--no-color"
"
" To use less-lint instead of less set the variable
" g:syntastic_less_use_less_lint.
if exists("loaded_less_syntax_checker") if exists("loaded_less_syntax_checker")
finish finish
endif endif
@@ -23,13 +31,20 @@ if !exists("g:syntastic_less_options")
let g:syntastic_less_options = "--no-color" let g:syntastic_less_options = "--no-color"
endif endif
function! SyntaxCheckers_less_GetLocList() if !exists("g:syntastic_less_use_less_lint")
let makeprg = 'lessc '. g:syntastic_less_options .' '. shellescape(expand('%')) . ' /dev/null' let g:syntastic_less_use_less_lint = 0
endif
"lessc >= 1.2 if g:syntastic_less_use_less_lint
let s:check_file = 'node ' . expand('<sfile>:p:h') . '/less-lint.js'
else
let s:check_file = 'lessc'
end
function! SyntaxCheckers_less_GetLocList()
let makeprg = s:check_file . ' ' . g:syntastic_less_options . ' ' .
\ shellescape(expand('%')) . ' /dev/null'
let errorformat = '%m in %f:%l:%c' let errorformat = '%m in %f:%l:%c'
"lessc < 1.2
let errorformat .= ', Syntax %trror on line %l in %f,Syntax %trror on line %l,! Syntax %trror: on line %l: %m,%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, return SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,

View File

@@ -40,8 +40,8 @@ function! SyntaxCheckers_php_GetLocList()
let errors = [] let errors = []
let makeprg = "php -l -d error_reporting=E_ALL -d display_errors=0 -d error_log='' ".shellescape(expand('%')) let makeprg = "php -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 ".shellescape(expand('%'))
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l,PHP Parse %trror: %m in %f on line %l' let errorformat='%-GNo syntax errors detected in%.%#,Parse error: %#syntax %trror\ , %m in %f on line %l,Parse %trror: %m in %f on line %l,Fatal %trror: %m in %f on line %l,%-G\s%#,%-GErrors parsing %.%#'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs") if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs")

View File

@@ -50,21 +50,8 @@ function! s:PuppetLintVersion()
return s:puppet_lint_version return s:puppet_lint_version
endfunction endfunction
"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 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 !g:syntastic_puppet_lint_disable
if !s:IsVersionAtLeast(s:PuppetLintVersion(), [0,1,10]) if !SyntasticIsVersionAtLeast(s:PuppetLintVersion(), [0,1,10])
let g:syntastic_puppet_lint_disable = 1 let g:syntastic_puppet_lint_disable = 1
endif endif
end end
@@ -81,34 +68,37 @@ endfunction
function! s:getPuppetMakeprg() function! s:getPuppetMakeprg()
"If puppet is >= version 2.7 then use the new executable "If puppet is >= version 2.7 then use the new executable
if s:IsVersionAtLeast(s:PuppetVersion(), [2,7,0]) if SyntasticIsVersionAtLeast(s:PuppetVersion(), [2,7,0])
let makeprg = 'puppet parser validate ' . let makeprg = 'puppet parser validate ' .
\ shellescape(expand('%')) . \ shellescape(expand('%')) .
\ ' --color=false' \ ' --color=false'
"add --ignoreimport for versions < 2.7.10
if s:PuppetVersion()[2] < '10'
let makeprg .= ' --ignoreimport'
endif
else else
let makeprg = 'puppet --color=false --parseonly --ignoreimport '.shellescape(expand('%')) let makeprg = 'puppet --color=false --parseonly '.shellescape(expand('%'))
endif endif
return makeprg return makeprg
endfunction endfunction
function! s:getPuppetEfm()
"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'
"Puppet 3.0.0 changes this from "err:" to "Error:"
"reset errorformat in that case
if SyntasticIsVersionAtLeast(s:PuppetVersion(), [3,0,0])
let errorformat = '%-GError: Try ''puppet help parser validate'' for usage,'
let errorformat .= 'Error: Could not parse for environment %*[a-z]: %m at %f:%l'
endif
return errorformat
endfunction
function! SyntaxCheckers_puppet_GetLocList() function! SyntaxCheckers_puppet_GetLocList()
let errors = [] let errors = []
if !g:syntastic_puppet_validate_disable if !g:syntastic_puppet_validate_disable
let makeprg = s:getPuppetMakeprg() let errors = errors + SyntasticMake({ 'makeprg': s:getPuppetMakeprg(), 'errorformat': s:getPuppetEfm() })
"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 endif
if !g:syntastic_puppet_lint_disable if !g:syntastic_puppet_lint_disable

View File

@@ -18,15 +18,6 @@ if exists("loaded_ruby_syntax_checker")
endif endif
let loaded_ruby_syntax_checker = 1 let loaded_ruby_syntax_checker = 1
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
if !exists("g:syntastic_ruby_checker") if !exists("g:syntastic_ruby_checker")
let g:syntastic_ruby_checker = "mri" let g:syntastic_ruby_checker = "mri"
endif endif

View File

@@ -9,6 +9,23 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
" "
"============================================================================ "============================================================================
function! s:FindRubyExec()
if executable("rvm")
return system("rvm tools identifier")
endif
return "ruby"
endfunction
if !exists("g:syntastic_ruby_exec")
let g:syntastic_ruby_exec = s:FindRubyExec()
endif
"bail if the user doesnt have ruby installed where they said it is
if !executable(expand(g:syntastic_ruby_exec))
finish
endif
function! SyntaxCheckers_ruby_GetLocList() function! SyntaxCheckers_ruby_GetLocList()
let makeprg = expand(g:syntastic_ruby_exec).' -w -T1 -c '.shellescape(expand('%')) let makeprg = expand(g:syntastic_ruby_exec).' -w -T1 -c '.shellescape(expand('%'))
if !has('win32') if !has('win32')
@@ -24,6 +41,12 @@ function! SyntaxCheckers_ruby_GetLocList()
"the word "possibly" in the warning "the word "possibly" in the warning
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context' 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%.%#' " filter out lines starting with ...
" long lines are truncated and wrapped in ... %p then returns the wrong
" column offset
let errorformat .= ',%-G%\%.%\%.%\%.%.%#'
let errorformat .= ',%-GSyntax OK,%E%f:%l: syntax error\, %m'
let errorformat .= ',%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction endfunction

View File

@@ -19,6 +19,11 @@ if !executable("sass")
finish finish
endif endif
"By default do not check partials as unknown variables are a syntax error
if !exists("g:syntastic_sass_check_partials")
let g:syntastic_sass_check_partials = 0
endif
"use compass imports if available "use compass imports if available
let s:imports = "" let s:imports = ""
if executable("compass") if executable("compass")
@@ -26,6 +31,9 @@ if executable("compass")
endif endif
function! SyntaxCheckers_sass_GetLocList() function! SyntaxCheckers_sass_GetLocList()
if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_'
return []
end
let makeprg='sass --no-cache '.s:imports.' --check '.shellescape(expand('%')) let makeprg='sass --no-cache '.s:imports.' --check '.shellescape(expand('%'))
let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%.%#' let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%.%#'
let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m' let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'

View File

@@ -1712,8 +1712,6 @@ function! s:InitWindow(autoclose) abort
setlocal nowrap setlocal nowrap
setlocal winfixwidth setlocal winfixwidth
setlocal textwidth=0 setlocal textwidth=0
setlocal nocursorline
setlocal nocursorcolumn
setlocal nospell setlocal nospell
if exists('+relativenumber') if exists('+relativenumber')
@@ -2501,7 +2499,8 @@ function! s:PrintKinds(typeinfo, fileinfo) abort
" only if they are not scope-defining tags (since " only if they are not scope-defining tags (since
" those already have an identifier) " those already have an identifier)
if !has_key(a:typeinfo.kind2scope, ckind.short) if !has_key(a:typeinfo.kind2scope, ckind.short)
silent put =' [' . ckind.long . ']' silent put =repeat(' ', g:tagbar_indent + 2) .
\ '[' . ckind.long . ']'
" Add basic tag to allow folding when on the " Add basic tag to allow folding when on the
" header line " header line
let headertag = s:BaseTag.New(ckind.long) let headertag = s:BaseTag.New(ckind.long)
@@ -2546,7 +2545,7 @@ function! s:PrintKinds(typeinfo, fileinfo) abort
if !kindtag.isFolded() if !kindtag.isFolded()
for tag in curtags for tag in curtags
let str = tag.strfmt() let str = tag.strfmt()
silent put =' ' . str silent put =repeat(' ', g:tagbar_indent) . str
" Save the current tagbar line in the tag for easy " Save the current tagbar line in the tag for easy
" highlighting access " highlighting access
@@ -2569,7 +2568,7 @@ endfunction
" s:PrintTag() {{{2 " s:PrintTag() {{{2
function! s:PrintTag(tag, depth, fileinfo, typeinfo) abort function! s:PrintTag(tag, depth, fileinfo, typeinfo) abort
" Print tag indented according to depth " Print tag indented according to depth
silent put =repeat(' ', a:depth * 2) . a:tag.strfmt() silent put =repeat(' ', a:depth * g:tagbar_indent) . a:tag.strfmt()
" Save the current tagbar line in the tag for easy " Save the current tagbar line in the tag for easy
" highlighting access " highlighting access
@@ -2587,8 +2586,8 @@ function! s:PrintTag(tag, depth, fileinfo, typeinfo) abort
" are not scope-defining tags (since those already have an " are not scope-defining tags (since those already have an
" identifier) " identifier)
if !has_key(a:typeinfo.kind2scope, ckind.short) if !has_key(a:typeinfo.kind2scope, ckind.short)
silent put =' ' . repeat(' ', a:depth * 2) . silent put =repeat(' ', (a:depth + 1) * g:tagbar_indent + 2)
\ '[' . ckind.long . ']' \ . '[' . ckind.long . ']'
" Add basic tag to allow folding when on the header line " Add basic tag to allow folding when on the header line
let headertag = s:BaseTag.New(ckind.long) let headertag = s:BaseTag.New(ckind.long)
let headertag.parent = a:tag let headertag.parent = a:tag

View File

@@ -408,6 +408,18 @@ Example:
let g:tagbar_compact = 1 let g:tagbar_compact = 1
< <
*g:tagbar_indent*
g:tagbar_indent~
Default: 2
The number of spaces by which each level is indented. This allows making the
display more compact or more spacious.
Example:
>
let g:tagbar_indent = 1
<
*g:tagbar_expand* *g:tagbar_expand*
g:tagbar_expand~ g:tagbar_expand~
Default: 0 Default: 0

View File

@@ -66,6 +66,10 @@ if !exists('g:tagbar_compact')
let g:tagbar_compact = 0 let g:tagbar_compact = 0
endif endif
if !exists('g:tagbar_indent')
let g:tagbar_indent = 2
endif
if !exists('g:tagbar_expand') if !exists('g:tagbar_expand')
let g:tagbar_expand = 0 let g:tagbar_expand = 0
endif endif