mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins. Added vim-golang as a mode
This commit is contained in:
@ -41,7 +41,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
|
||||
|
||||
endif
|
||||
|
||||
return term != '' ? '\V\<' . term . '\>' : ''
|
||||
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
|
||||
|
@ -26,7 +26,7 @@ set cpo&vim
|
||||
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
|
||||
if term != ''
|
||||
let term = '\V' . term
|
||||
let term = '\V' . escape(term, '\')
|
||||
endif
|
||||
return term
|
||||
endfunction
|
||||
|
@ -2,10 +2,11 @@
|
||||
-export([main/1]).
|
||||
|
||||
main([FileName]) ->
|
||||
LibDirs = filelib:wildcard("{lib,deps}/*/ebin"),
|
||||
LibDirs = (["ebin", "include", "src", "test"] ++
|
||||
filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")),
|
||||
compile(FileName, LibDirs);
|
||||
|
||||
main([FileName | ["-rebar" | [Path | LibDirs]]]) ->
|
||||
main([FileName, "-rebar", Path, LibDirs]) ->
|
||||
{ok, L} = file:consult(Path),
|
||||
P = dict:from_list(L),
|
||||
Root = filename:dirname(Path),
|
||||
@ -31,23 +32,20 @@ main([FileName | ["-rebar" | [Path | LibDirs]]]) ->
|
||||
%io:format("~p~n", [LibDirs1]),
|
||||
compile(FileName, LibDirs1);
|
||||
|
||||
main([FileName | LibDirs]) ->
|
||||
main([FileName, LibDirs]) ->
|
||||
compile(FileName, LibDirs).
|
||||
|
||||
compile(FileName, LibDirs) ->
|
||||
Root = get_root(filename:dirname(FileName)),
|
||||
ok = code:add_pathsa(LibDirs),
|
||||
compile:file(FileName, [warn_obsolete_guard,
|
||||
warn_unused_import,
|
||||
warn_shadow_vars,
|
||||
warn_export_vars,
|
||||
strong_validation,
|
||||
report,
|
||||
{i, filename:join(Root, "include")},
|
||||
{i, filename:join(Root, "deps")},
|
||||
{i, filename:join(Root, "apps")},
|
||||
{i, filename:join(Root, "lib")}
|
||||
]).
|
||||
compile:file(FileName,
|
||||
[warn_obsolete_guard,
|
||||
warn_unused_import,
|
||||
warn_shadow_vars,
|
||||
warn_export_vars,
|
||||
strong_validation,
|
||||
report] ++
|
||||
[{i, filename:join(Root, I)} || I <- LibDirs]).
|
||||
|
||||
get_root(Dir) ->
|
||||
Path = filename:split(filename:absname(Dir)),
|
||||
|
@ -22,7 +22,7 @@ set cpo&vim
|
||||
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
|
||||
if term != ''
|
||||
let term = '\V' . term
|
||||
let term = '\V' . escape(term, '\')
|
||||
endif
|
||||
return term
|
||||
endfunction
|
||||
|
@ -26,7 +26,7 @@ function! SyntaxCheckers_lex_flex_GetHighlightRegex(item)
|
||||
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
|
||||
endif
|
||||
|
||||
return term != '' ? '\V' . term : ''
|
||||
return term != '' ? '\V' . escape(term, '\') : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_lex_flex_GetLocList() dict
|
||||
|
@ -28,7 +28,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||
let a:pos['col'] = p[2]
|
||||
let result = '\%' . p[2] . 'c'
|
||||
else
|
||||
let result = '\V' . near
|
||||
let result = '\V' . escape(near, '\')
|
||||
endif
|
||||
|
||||
" XXX the following piece of code is evil, and is likely to break
|
||||
@ -38,7 +38,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||
"if open != ''
|
||||
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
||||
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||
" call matchadd(group, '\%' . line . 'l\V' . open)
|
||||
" call matchadd(group, '\%' . line . 'l\V' . escape(open, '\'))
|
||||
"endif
|
||||
endif
|
||||
return result
|
||||
|
@ -11,6 +11,22 @@
|
||||
"
|
||||
"============================================================================
|
||||
"
|
||||
" Security:
|
||||
"
|
||||
" This checker runs 'perl -c' against your file, which in turn executes
|
||||
" any BEGIN, UNITCHECK, and CHECK blocks, and any use statements in
|
||||
" your file. This is probably fine if you wrote the file yourself,
|
||||
" but it can be a problem if you're trying to check third party files.
|
||||
" If you are 100% willing to let Vim run the code in your file, set
|
||||
" g:syntastic_enable_perl_checker to 1 in your vimrc to enable this
|
||||
" checker:
|
||||
"
|
||||
" let g:syntastic_enable_perl_checker = 1
|
||||
"
|
||||
" References:
|
||||
"
|
||||
" - http://perldoc.perl.org/perlrun.html#*-c*
|
||||
"
|
||||
" Checker options:
|
||||
"
|
||||
" - g:syntastic_perl_interpreter (string; default: 'perl')
|
||||
@ -24,11 +40,7 @@
|
||||
if exists('g:loaded_syntastic_perl_perl_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_perl_perl_checker=1
|
||||
|
||||
if !exists('g:syntastic_perl_interpreter')
|
||||
let g:syntastic_perl_interpreter = 'perl'
|
||||
endif
|
||||
let g:loaded_syntastic_perl_perl_checker = 1
|
||||
|
||||
if !exists('g:syntastic_perl_lib_path')
|
||||
let g:syntastic_perl_lib_path = []
|
||||
@ -38,6 +50,10 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
||||
if !exists('g:syntastic_perl_interpreter')
|
||||
let g:syntastic_perl_interpreter = self.getExec()
|
||||
endif
|
||||
|
||||
" don't call executable() here, to allow things like
|
||||
" let g:syntastic_perl_interpreter='/usr/bin/env perl'
|
||||
silent! call system(syntastic#util#shexpand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)'))
|
||||
@ -45,6 +61,11 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_perl_perl_GetLocList() dict
|
||||
if !exists('g:syntastic_enable_perl_checker') || !g:syntastic_enable_perl_checker
|
||||
call syntastic#log#error('checker perl/perl: checks disabled for security reasons; set g:syntastic_enable_perl_checker to 1 to override')
|
||||
return []
|
||||
endif
|
||||
|
||||
let exe = expand(g:syntastic_perl_interpreter)
|
||||
if type(g:syntastic_perl_lib_path) == type('')
|
||||
call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list')
|
||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_php_php_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'")
|
||||
return term != '' ? '\V' . term : ''
|
||||
return term != '' ? '\V' . escape(term, '\') : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_php_php_GetLocList() dict
|
||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown')
|
||||
return term != '' ? '\V' . term : ''
|
||||
return term != '' ? '\V' . escape(term, '\') : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_po_msgfmt_GetLocList() dict
|
||||
|
@ -39,7 +39,7 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||
if len(parts) >= 4
|
||||
let e["type"] = parts[1][0]
|
||||
let e["text"] = parts[3] . ' [' . parts[1] . ']'
|
||||
let e["hl"] = '\V' . parts[2]
|
||||
let e["hl"] = '\V' . escape(parts[2], '\')
|
||||
elseif e["text"] =~? '\v^I\d+:'
|
||||
let e["valid"] = 0
|
||||
else
|
||||
|
@ -21,7 +21,7 @@ set cpo&vim
|
||||
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
||||
let term = split(a:i['text'], ' - ')[1]
|
||||
return '\V\<'.term.'\>'
|
||||
return '\V\<' . escape(term, '\') . '\>'
|
||||
endif
|
||||
|
||||
return ''
|
||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_texinfo_makeinfo_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], "\\m`\\zs[^']\\+\\ze'")
|
||||
return term != '' ? '\V' . term : ''
|
||||
return term != '' ? '\V' . escape(term, '\') : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_texinfo_makeinfo_GetLocList() dict
|
||||
|
@ -22,7 +22,7 @@ function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)')
|
||||
if term != ''
|
||||
let col = get(a:item, 'col', 0)
|
||||
let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . term
|
||||
let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . escape(term, '\')
|
||||
endif
|
||||
return term
|
||||
endfunction
|
||||
|
@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item)
|
||||
endif
|
||||
endif
|
||||
|
||||
return '\V' . (col ? '\%' . col . 'c' : '') . term
|
||||
return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\')
|
||||
endif
|
||||
|
||||
return ''
|
||||
|
Reference in New Issue
Block a user