1
0
mirror of https://github.com/amix/vimrc synced 2025-06-23 23:15:01 +08:00

Updated vimrc

This commit is contained in:
amix
2015-07-13 11:22:46 +01:00
parent 9a2843c2a5
commit d7752b59ae
301 changed files with 4699 additions and 7969 deletions

View File

@ -53,21 +53,22 @@ are detected, the user is notified and is happy because they didn't have to
compile their code or execute their script to find them.
At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell,
C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D,
Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL,
Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX,
LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB,
NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml,
Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex,
Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM,
Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG,
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Tcl, TeX,
Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC,
YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details about
the corresponding supported checkers.
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, Tcl,
TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT,
YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details
about the corresponding supported checkers.
A number of third-party Vim plugins also provide checkers for syntastic,
for example: [omnisharp-vim][25], [rust.vim][12], [syntastic-extras][26],
[syntastic-more][27], and [vim-swift][24].
[syntastic-more][27], [vim-crystal][29], [vim-eastwood][28], and
[vim-swift][24].
Below is a screenshot showing the methods that Syntastic uses to display syntax
errors. Note that, in practise, you will only have a subset of these methods
@ -410,7 +411,7 @@ work around it:
```vim
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd lclose\|bdelete
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
```
<a name="otherresources"></a>
@ -456,6 +457,8 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[25]: https://github.com/OmniSharp/omnisharp-vim
[26]: https://github.com/myint/syntastic-extras
[27]: https://github.com/roktas/syntastic-more
[28]: https://github.com/venantius/vim-eastwood
[29]: https://github.com/rhysd/vim-crystal
<!--
vim:tw=79:sw=4:

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_c_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_c_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_c_autoload = 1
@ -21,8 +21,8 @@ function! syntastic#c#ReadConfig(file) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
" search upwards from the current file's directory
let config = findfile(a:file, '.;')
if config == ''
let config = syntastic#util#findFileInParent(a:file, expand('%:p:h', 1))
if config ==# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
return ''
endif
@ -44,7 +44,7 @@ function! syntastic#c#ReadConfig(file) abort " {{{2
endtry
" filter out empty lines and comments
call filter(lines, 'v:val !~ ''\v^(\s*#|$)''')
call filter(lines, 'v:val !~# ''\v^(\s*#|$)''')
" remove leading and trailing spaces
call map(lines, 'substitute(v:val, ''\m^\s\+'', "", "")')
@ -53,7 +53,7 @@ function! syntastic#c#ReadConfig(file) abort " {{{2
let parameters = []
for line in lines
let matches = matchstr(line, '\m\C^\s*-I\s*\zs.\+')
if matches != ''
if matches !=# ''
" this one looks like an absolute path
if match(matches, '\m^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches)
@ -120,9 +120,9 @@ endfunction " }}}2
" register a handler dictionary object
function! s:_registerHandler(regex, function, args) abort " {{{2
let handler = {}
let handler["regex"] = a:regex
let handler["func"] = function(a:function)
let handler["args"] = a:args
let handler['regex'] = a:regex
let handler['func'] = function(a:function)
let handler['args'] = a:args
call add(s:handlers, handler)
endfunction " }}}2
@ -223,10 +223,10 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2
" check if the user manually set some cflags
let b_cflags = s:_get_checker_var('b', a:ft, a:ck, 'cflags', '')
if b_cflags == ''
" check whether to search for include files at all
if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
if a:ft ==# 'c' || a:ft ==# 'cpp'
if b_cflags ==# ''
if a:ft ==# 'c' || a:ft ==# 'cpp'
" check whether to search for include files at all
if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
" refresh the include file search if desired
if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0)
let flags .= ' ' . s:_search_headers()
@ -280,15 +280,15 @@ function! s:_search_headers() abort " {{{2
" search current buffer
for line in lines
let file = matchstr(line, '\m"\zs\S\+\ze"')
if file != ''
if file !=# ''
call add(files, file)
continue
endif
for handler in s:handlers
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
if line =~# handler['regex']
let includes .= call(handler['func'], handler['args'])
call add(found, handler['regex'])
break
endif
endfor
@ -296,7 +296,7 @@ function! s:_search_headers() abort " {{{2
" search included headers
for hfile in files
if hfile != ''
if hfile !=# ''
let filename = expand('%:p:h', 1) . syntastic#util#Slash() . hfile
try
@ -308,14 +308,14 @@ function! s:_search_headers() abort " {{{2
call filter(lines, 'v:val =~# ''\m^\s*#\s*include''')
for handler in s:handlers
if index(found, handler["regex"]) != -1
if index(found, handler['regex']) != -1
continue
endif
for line in lines
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
if line =~# handler['regex']
let includes .= call(handler['func'], handler['args'])
call add(found, handler['regex'])
break
endif
endfor

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_log_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_log_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_log_autoload = 1
@ -11,19 +11,19 @@ let s:one_time_notices_issued = []
" Public functions {{{1
function! syntastic#log#info(msg) abort " {{{2
echomsg "syntastic: info: " . a:msg
echomsg 'syntastic: info: ' . a:msg
endfunction " }}}2
function! syntastic#log#warn(msg) abort " {{{2
echohl WarningMsg
echomsg "syntastic: warning: " . a:msg
echomsg 'syntastic: warning: ' . a:msg
echohl None
endfunction " }}}2
function! syntastic#log#error(msg) abort " {{{2
execute "normal \<Esc>"
echohl ErrorMsg
echomsg "syntastic: error: " . a:msg
echomsg 'syntastic: error: ' . a:msg
echohl None
endfunction " }}}2
@ -88,9 +88,9 @@ function! syntastic#log#debugShowOptions(level, names) abort " {{{2
let leader = s:_log_timestamp()
call s:_logRedirect(1)
let vlist = copy(type(a:names) == type("") ? [a:names] : a:names)
let vlist = copy(type(a:names) == type('') ? [a:names] : a:names)
if !empty(vlist)
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))")
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val))) . (s:_is_modified(v:val) ? ' (!)' : '')")
echomsg leader . join(vlist, ', ')
endif
call s:_logRedirect(0)
@ -104,10 +104,10 @@ function! syntastic#log#debugShowVariables(level, names) abort " {{{2
let leader = s:_log_timestamp()
call s:_logRedirect(1)
let vlist = type(a:names) == type("") ? [a:names] : a:names
let vlist = type(a:names) == type('') ? [a:names] : a:names
for name in vlist
let msg = s:_format_variable(name)
if msg != ''
if msg !=# ''
echomsg leader . msg
endif
endfor
@ -123,6 +123,21 @@ function! syntastic#log#debugDump(level) abort " {{{2
call syntastic#log#debugShowVariables( a:level, sort(keys(g:_SYNTASTIC_DEFAULTS)) )
endfunction " }}}2
function! syntastic#log#ndebug(level, title, messages) abort " {{{2
if s:_isDebugEnabled(a:level)
return
endif
call syntastic#log#error(a:title)
if type(a:messages) == type([])
for msg in a:messages
echomsg msg
endfor
else
echomsg a:messages
endif
endfunction " }}}2
" }}}1
" Private functions {{{1
@ -140,7 +155,7 @@ let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's
lockvar s:_isDebugEnabled
function! s:_logRedirect(on) abort " {{{2
if exists("g:syntastic_debug_file")
if exists('g:syntastic_debug_file')
if a:on
try
execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file, 1))
@ -174,6 +189,20 @@ function! s:_format_variable(name) abort " {{{2
return join(vals, ', ')
endfunction " }}}2
function! s:_is_modified(name) abort " {{{2
if !exists('s:option_defaults')
let s:option_defaults = {}
endif
if !has_key(s:option_defaults, a:name)
let opt_save = eval('&' . a:name)
execute 'set ' . a:name . '&'
let s:option_defaults[a:name] = eval('&' . a:name)
execute 'let &' . a:name . ' = ' . string(opt_save)
endif
return s:option_defaults[a:name] !=# eval('&' . a:name)
endfunction " }}}2
" }}}1
let &cpo = s:save_cpo

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_postprocess_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_postprocess_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_postprocess_autoload = 1

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_preprocess_autoload") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_preprocess_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_preprocess_autoload = 1
@ -13,14 +13,14 @@ function! syntastic#preprocess#cabal(errors) abort " {{{2
let star = 0
for err in a:errors
if star
if err == ''
if err ==# ''
let star = 0
else
let out[-1] .= ' ' . err
endif
else
call add(out, err)
if err =~ '\m^*\s'
if err =~# '\m^*\s'
let star = 1
endif
endif
@ -68,10 +68,15 @@ function! syntastic#preprocess#flow(errors) abort " {{{2
let false = 0
let null = ''
let idx = 0
while idx < len(a:errors) && a:errors[idx][0] != '{'
let idx += 1
endwhile
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors, ''))
let errs = eval(join(a:errors[idx :], ''))
catch
let errs = {}
endtry
@ -88,7 +93,7 @@ function! syntastic#preprocess#flow(errors) abort " {{{2
\ m['path'] . ':' .
\ m['line'] . ':' .
\ m['start'] . ':' .
\ (m['line'] ==# m['endline'] ? m['end'] . ':' : '') .
\ (m['line'] ==# m['endline'] && str2nr(m['end']) > 0 ? m['end'] . ':' : '') .
\ ' ' . m['descr']
if len(t)
@ -123,8 +128,15 @@ endfunction " }}}2
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#iconv(errors) abort " {{{2
return
\ (has('iconv') || has('iconv/dyn')) && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') :
\ a:errors
endfunction " }}}2
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
return filter(copy(a:errors), 'v:val != ""')
return filter(copy(a:errors), 'v:val !=# ""')
endfunction " }}}2
function! syntastic#preprocess#perl(errors) abort " {{{2
@ -204,7 +216,7 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2
" remove uninteresting lines and handle continuations
let i = 0
while i < len(errlist)
if i > 0 && errlist[i][:1] == ' ' && errlist[i] !~ '\m\s\+\^$'
if i > 0 && errlist[i][:1] ==# ' ' && errlist[i] !~# '\m\s\+\^$'
let errlist[i-1] .= errlist[i][1:]
call remove(errlist, i)
elseif errlist[i] !~# '\m^\(Lint:\|Lint checking:\|Error in\) '
@ -224,7 +236,7 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2
call add(out, 'E:' . fname . ':' . line . ': ' . parts[1])
endfor
endif
if len(parts) >= 5 && parts[4] != ''
if len(parts) >= 5 && parts[4] !=# ''
call add(out, 'E:' . fname . ':0: ' . parts[1] . ' - ' . parts[4] . ' messages not shown')
endif
elseif match(e, '\m^Lint checking: ') == 0

View File

@ -1,4 +1,4 @@
if exists('g:loaded_syntastic_util_autoload') || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_util_autoload') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_util_autoload = 1
@ -21,7 +21,7 @@ endfunction " }}}2
" Get directory separator
function! syntastic#util#Slash() abort " {{{2
return (!exists("+shellslash") || &shellslash) ? '/' : '\'
return (!exists('+shellslash') || &shellslash) ? '/' : '\'
endfunction " }}}2
function! syntastic#util#CygwinPath(path) abort " {{{2
@ -53,19 +53,19 @@ function! syntastic#util#tmpdir() abort " {{{2
if (has('unix') || has('mac')) && executable('mktemp')
" TODO: option "-t" to mktemp(1) is not portable
let tmp = $TMPDIR != '' ? $TMPDIR : $TMP != '' ? $TMP : '/tmp'
let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp'
let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
if v:shell_error == 0 && len(out) == 1
let tempdir = out[0]
endif
endif
if tempdir == ''
if tempdir ==# ''
if has('win32') || has('win64')
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid()
elseif has('win32unix')
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
elseif $TMPDIR != ''
elseif $TMPDIR !=# ''
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
else
let tempdir = '/tmp/vim-syntastic-' . getpid()
@ -97,7 +97,7 @@ function! syntastic#util#rmrf(what) abort " {{{2
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
endif
if s:rmrf != ''
if s:rmrf !=# ''
silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
else
call s:_rmrf(a:what)
@ -120,7 +120,7 @@ endfunction " }}}2
function! syntastic#util#parseShebang() abort " {{{2
for lnum in range(1, 5)
let line = getline(lnum)
if line =~ '^#!'
if line =~# '^#!'
let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '')
let exe = matchstr(line, '\m^\S*\ze')
let args = split(matchstr(line, '\m^\S*\zs.*'))
@ -140,8 +140,8 @@ function! syntastic#util#var(name, ...) abort " {{{2
endfunction " }}}2
" Parse a version string. Return an array of version components.
function! syntastic#util#parseVersion(version) abort " {{{2
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
function! syntastic#util#parseVersion(version, ...) abort " {{{2
return map(split(matchstr( a:version, a:0 ? a:1 : '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
endfunction " }}}2
" Verify that the 'installed' version is at least the 'required' version.
@ -164,7 +164,7 @@ function! syntastic#util#compareLexi(a, b) abort " {{{2
return a_element > b_element ? 1 : -1
endif
endfor
" Everything matched, so it is at least the required version.
" still here, thus everything matched
return 0
endfunction " }}}2
@ -190,7 +190,7 @@ function! syntastic#util#wideMsg(msg) abort " {{{2
"This is here because it is possible for some error messages to
"begin with \n which will cause a "press enter" prompt.
let msg = substitute(a:msg, "\n", "", "g")
let msg = substitute(a:msg, "\n", '', 'g')
"convert tabs to spaces so that the tabs count towards the window
"width as the proper amount of characters
@ -226,13 +226,23 @@ function! syntastic#util#bufIsActive(buffer) abort " {{{2
return 0
endfunction " }}}2
" start in directory a:where and walk up the parent folders until it
" finds a file matching a:what; return path to that file
function! syntastic#util#findInParent(what, where) abort " {{{2
" start in directory a:where and walk up the parent folders until it finds a
" file named a:what; return path to that file
function! syntastic#util#findFileInParent(what, where) abort " {{{2
let old_suffixesadd = &suffixesadd
let &suffixesadd = ''
let file = findfile(a:what, escape(a:where, ' ') . ';')
let &suffixesadd = old_suffixesadd
return file
endfunction " }}}2
" start in directory a:where and walk up the parent folders until it finds a
" file matching a:what; return path to that file
function! syntastic#util#findGlobInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p')
let root = syntastic#util#Slash()
if syntastic#util#isRunningWindows() && here[1] == ':'
if syntastic#util#isRunningWindows() && here[1] ==# ':'
" The drive letter is an ever-green source of fun. That's because
" we don't care about running syntastic on Amiga these days. ;)
let root = fnamemodify(root, ':p')
@ -240,7 +250,7 @@ function! syntastic#util#findInParent(what, where) abort " {{{2
endif
let old = ''
while here != ''
while here !=# ''
let p = split(globpath(here, a:what, 1), '\n')
if !empty(p)
@ -284,7 +294,7 @@ endfunction " }}}2
" Escape arguments
function! syntastic#util#argsescape(opt) abort " {{{2
if type(a:opt) == type('') && a:opt != ''
if type(a:opt) == type('') && a:opt !=# ''
return [a:opt]
elseif type(a:opt) == type([])
return map(copy(a:opt), 'syntastic#util#shescape(v:val)')
@ -323,11 +333,10 @@ function! syntastic#util#dictFilter(errors, filter) abort " {{{2
endtry
endfunction " }}}2
" Return a [high, low] list of integers, representing the time
" (hopefully high resolution) since program start
" TODO: This assumes reltime() returns a list of integers.
" Return a [seconds, fractions] list of strings, representing the
" (hopefully high resolution) time since program start
function! syntastic#util#stamp() abort " {{{2
return reltime(g:_SYNTASTIC_START)
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
endfunction " }}}2
" }}}1
@ -345,14 +354,14 @@ function! s:_translateFilter(filters) abort " {{{2
endfor
if conditions == []
let conditions = ["1"]
let conditions = ['1']
endif
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
endfunction " }}}2
function! s:_translateElement(key, term) abort " {{{2
let fkey = a:key
if fkey[0] == '!'
if fkey[0] ==# '!'
let fkey = fkey[1:]
let not = 1
else
@ -377,13 +386,13 @@ function! s:_translateElement(key, term) abort " {{{2
let op = not ? ' =~# ' : ' !~# '
let ret = 'bufname(str2nr(v:val["bufnr"]))'
let mod = fkey[4:]
if mod != ''
if mod !=# ''
let ret = 'fnamemodify(' . ret . ', ' . string(mod) . ')'
endif
let ret .= op . string(a:term)
else
call syntastic#log#warn('quiet_messages: ignoring invalid key ' . strtrans(string(fkey)))
let ret = "1"
let ret = '1'
endif
return ret
endfunction " }}}2

View File

@ -40,16 +40,21 @@ CONTENTS *syntastic-contents*
6.1.Handling of composite filetypes........|syntastic-composite|
6.2.Editing files over network.............|syntastic-netrw|
6.3.The 'shellslash' option................|syntastic-shellslash|
6.4.Saving Vim sessions....................|syntastic-sessions|
7.Compatibility with other software............|syntastic-compatibility|
7.1.The csh and tcsh shells................|syntastic-csh|
7.2.Eclim..................................|syntastic-eclim|
7.3.The fish shell.........................|syntastic-fish|
7.4.The fizsh shell........................|syntastic-fizsh|
7.5.The PowerShell shell...................|syntastic-powershell|
7.6.python-mode............................|syntastic-pymode|
7.7.vim-auto-save..........................|syntastic-vim-auto-save|
7.8.vim-virtualenv.........................|syntastic-vim-virtualenv|
7.9.YouCompleteMe..........................|syntastic-ycm|
7.5.flagship...............................|syntastic-flagship|
7.6.powerline..............................|syntastic-powerline|
7.7.The PowerShell shell...................|syntastic-powershell|
7.8.python-mode............................|syntastic-pymode|
7.9.vim-auto-save..........................|syntastic-vim-auto-save|
7.10.vim-go................................|syntastic-vim-go|
7.11.vim-virtualenv........................|syntastic-vim-virtualenv|
7.12.YouCompleteMe.........................|syntastic-ycm|
7.13.The zsh shell and rvm.................|syntastic-zsh|
8.About........................................|syntastic-about|
9.License......................................|syntastic-license|
@ -457,7 +462,7 @@ Use this option to map non-standard filetypes to standard ones. Corresponding
checkers are mapped accordingly, which allows syntastic to check files with
non-standard filetypes: >
let g:syntastic_filetype_map = {
\ "latex": "tex",
\ "plaintex": "tex",
\ "gentoo-metadata": "xml" }
<
Composite filetypes can also be mapped to simple types, which disables the
@ -809,6 +814,16 @@ shell. It should be turned off if your 'shell' (or |g:syntastic_shell|) is
"sh". Most checkers will stop working if 'shellslash' is set to the wrong
value.
------------------------------------------------------------------------------
6.4 Saving Vim sessions *syntastic-sessions*
If you use |:mksession| to save Vim sessions you should probably make sure to
remove option "blank" from 'sessionoptions': >
set sessionoptions-=blank
<
This will prevent |:mksession| from saving |syntastic-error-window| as empty
quickfix windows.
==============================================================================
7. Compatibility with other software *syntastic-compatibility*
@ -858,7 +873,34 @@ interactive features of "fizsh". Using a more traditional shell such as "zsh",
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
7.5. The PowerShell shell *syntastic-powershell*
7.5 flagship *syntastic-flagship*
The "flagship" Vim plugin (https://github.com/tpope/vim-flagship) has its
own mechanism of showing flags on the |'statusline'|. To allow "flagship"
to manage syntastic's statusline flag add the following |autocommand| to
your vimrc, rather than explicitly adding the flag to your |'statusline'| as
described in the |syntastic-statusline-flag| section above: >
autocmd User Flags call Hoist("window", "SyntasticStatuslineFlag")
<
------------------------------------------------------------------------------
7.6. powerline *syntastic-powerline*
The "powerline" Vim plugin (https://github.com/powerline/powerline) comes
packaged with a syntastic segment. To customize this segment create a file
~/.config/powerline/themes/vim/default.json, with a content like this: >
{
"segment_data" : {
"powerline.segments.vim.plugin.syntastic.syntastic" : {
"args" : {
"err_format" : "Err: {first_line} #{num} ",
"warn_format" : "Warn: {first_line} #{num} "
}
}
}
}
<
------------------------------------------------------------------------------
7.7. The PowerShell shell *syntastic-powershell*
At the time of this writing, syntastic is not compatible with using "Windows
PowerShell" (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
@ -867,7 +909,7 @@ Vim's 'shell' to a more traditional program, such as "cmd.exe": >
set shell=cmd.exe
<
------------------------------------------------------------------------------
7.6 python-mode *syntastic-pymode*
7.8 python-mode *syntastic-pymode*
Syntastic can be used along with the "python-mode" Vim plugin (see
https://github.com/klen/python-mode). However, they both run syntax checks by
@ -878,14 +920,27 @@ for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
let g:pymode_lint_write = 0
<
------------------------------------------------------------------------------
7.7. vim-auto-save *syntastic-vim-auto-save*
7.9. vim-auto-save *syntastic-vim-auto-save*
Syntastic can be used together with the "vim-auto-save" Vim plugin (see
https://github.com/907th/vim-auto-save). However, syntastic checks in active
mode only work with "vim-auto-save" version 0.1.7 or later.
------------------------------------------------------------------------------
7.8. vim-virtualenv *syntastic-vim-virtualenv*
7.10. vim-go *syntastic-vim-go*
The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
lists, and thus doesn't conflict with syntastic (which uses |location-list|
lists). However, both "vim-go" and syntastic run syntax checks by default
when you save buffers to disk, and this can have confusing results. To
avoid both plugins opening error windows, you can either set passive
mode for go in syntastic (see |syntastic_mode_map|), or prevent "vim-go"
from showing a quickfix window when |g:go_fmt_command| fails, by setting
|g:go_fmt_fail_silently| to 1. E.g.: >
let g:go_fmt_fail_silently = 1
<
------------------------------------------------------------------------------
7.11. vim-virtualenv *syntastic-vim-virtualenv*
At the time of this writing, syntastic can't run checkers installed
in Python virtual environments activated by "vim-virtualenv" (see
@ -893,7 +948,7 @@ https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
"vim-virtualenv".
------------------------------------------------------------------------------
7.9 YouCompleteMe *syntastic-ycm*
7.12 YouCompleteMe *syntastic-ycm*
Syntastic can be used together with the "YouCompleteMe" Vim plugin (see
http://valloric.github.io/YouCompleteMe/). However, by default "YouCompleteMe"
@ -903,6 +958,18 @@ identifier completer but still run syntastic's checkers for those filetypes you
have to set |ycm_show_diagnostics_ui| to 0. E.g.: >
let g:ycm_show_diagnostics_ui = 0
<
------------------------------------------------------------------------------
7.13 The zsh shell and rvm *syntastic-zsh*
If you're running MacVim together with the "zsh" shell (http://www.zsh.org/)
and "rvm" (https://rvm.io/), you need to be aware that MacVim does not source
the .zshrc file, but will source a .zshenv file. Consequently you have to
either source the "rvm" scripts from within .zshenv, or just change your shell
to something else: >
set shell=/bin/sh
<
Of course, you'll have to make sure "rvm" still works in the new shell.
==============================================================================
8. About *syntastic-about*

View File

@ -9,7 +9,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_plugin = 1
@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-57'
let g:_SYNTASTIC_VERSION = '3.6.0-122'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
@ -34,7 +34,7 @@ for s:feature in [
\ 'user_commands'
\ ]
if !has(s:feature)
call syntastic#log#error("need Vim compiled with feature " . s:feature)
call syntastic#log#error('need Vim compiled with feature ' . s:feature)
finish
endif
endfor
@ -104,7 +104,7 @@ for s:key in keys(g:_SYNTASTIC_DEFAULTS)
endif
endfor
if exists("g:syntastic_quiet_warnings")
if exists('g:syntastic_quiet_warnings')
call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead")
if g:syntastic_quiet_warnings
let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', [])
@ -246,29 +246,29 @@ endif
function! s:BufReadPostHook() abort " {{{2
if g:syntastic_check_on_open
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
\ 'autocmd: BufReadPost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, [])
endif
endfunction " }}}2
function! s:BufWritePostHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
\ 'autocmd: BufWritePost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, [])
endfunction " }}}2
function! s:BufEnterHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
\ 'autocmd: BufEnter, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))) .
\ ', &buftype = ' . string(&buftype))
if &buftype == ''
if &buftype ==# ''
call s:notifiers.refresh(g:SyntasticLoclist.current())
elseif &buftype ==# 'quickfix'
" TODO: this is needed because in recent versions of Vim lclose
" can no longer be called from BufWinLeave
" TODO: at this point there is no b:syntastic_loclist
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer'))
let owner = str2nr(getbufvar(bufnr(''), 'syntastic_owner_buffer'))
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
if get(w:, 'syntastic_loclist_set', 0) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call SyntasticLoclistHide()
@ -278,7 +278,7 @@ endfunction " }}}2
function! s:QuitPreHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
\ 'autocmd: QuitPre, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
if get(w:, 'syntastic_loclist_set', 0)
call SyntasticLoclistHide()
@ -304,6 +304,9 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
if run_checks
call s:CacheErrors(a:checker_names)
unlockvar! b:syntastic_changedtick
let b:syntastic_changedtick = b:changedtick
lockvar! b:syntastic_changedtick
endif
let loclist = g:SyntasticLoclist.current()
@ -335,7 +338,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
" order, which can lead to missing filetype when jumping
" to a new file; the following is a workaround for the
" resulting brain damage
if &filetype == ''
if &filetype ==# ''
silent! filetype detect
endif
endif
@ -544,11 +547,12 @@ function! SyntasticMake(options) abort " {{{2
let &l:errorformat = old_local_errorformat
" }}}3
if !s:_running_windows && (s:_os_name() =~? "FreeBSD" || s:_os_name() =~? "OpenBSD")
if !s:_running_windows && (s:_os_name() =~? 'FreeBSD' || s:_os_name() =~? 'OpenBSD')
call syntastic#util#redraw(g:syntastic_full_redraws)
endif
if bailout
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', err_lines)
throw 'Syntastic: checker error'
endif
@ -609,7 +613,7 @@ endfunction " }}}2
" Skip running in special buffers
function! s:_skip_file() abort " {{{2
let fname = expand('%', 1)
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype != '') ||
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype !=# '') ||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip
@ -627,7 +631,7 @@ function! s:_explain_skip(filetypes) abort " {{{2
if get(b:, 'syntastic_skip_checks', 0)
call add(why, 'b:syntastic_skip_checks set')
endif
if &buftype != ''
if &buftype !=# ''
call add(why, 'buftype = ' . string(&buftype))
endif
if !filereadable(fname)

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_autoloclist") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_autoloclist') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_autoloclist = 1

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_balloons") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_balloons') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_balloons = 1

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_checker") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_checker') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_checker = 1
@ -25,6 +25,10 @@ function! g:SyntasticChecker.New(args) abort " {{{2
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
endif
if has_key(a:args, 'enable')
let newObj._enable = a:args['enable']
endif
let newObj._locListFunc = function(prefix . 'GetLocList')
if exists('*' . prefix . 'IsAvailable')
@ -54,12 +58,12 @@ endfunction " }}}2
" getExec() or getExecEscaped(). Normally isAvailable() does that for you
" automatically, but you should keep still this in mind if you change the
" current checker workflow.
function! g:SyntasticChecker.syncExec() dict " {{{2
function! g:SyntasticChecker.syncExec() abort " {{{2
let user_exec =
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
if user_exec != '' && user_exec !=# self._exec
if user_exec !=# '' && user_exec !=# self._exec
let self._exec = user_exec
if has_key(self, '_available')
" we have a new _exec on the block, it has to be validated
@ -78,14 +82,29 @@ endfunction " }}}2
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
let name = self._filetype . '/' . self._name
if has_key(self, '_enable')
let status = syntastic#util#var(self._enable, -1)
if status < 0
call syntastic#log#error('checker ' . name . ': checks disabled for security reasons; ' .
\ 'set g:syntastic_' . self._enable . ' to 1 to override')
endif
if status <= 0
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' enabled but not forced')
return []
else
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' forced')
endif
endif
try
let list = self._locListFunc()
if self._exec != ''
if self._exec !=# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
endif
catch /\m\C^Syntastic: checker error$/
let list = []
if self._exec != ''
if self._exec !=# ''
call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error)
else
call syntastic#log#error('checker ' . name . ' aborted')
@ -108,7 +127,13 @@ function! g:SyntasticChecker.getVersion(...) abort " {{{2
call self.log('getVersion: ' . string(command) . ': ' .
\ string(split(version_output, "\n", 1)) .
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
call self.setVersion(syntastic#util#parseVersion(version_output))
let parsed_ver = syntastic#util#parseVersion(version_output)
if len(parsed_ver)
call self.setVersion(parsed_ver)
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
endif
endif
return get(self, '_version', [])
endfunction " }}}2
@ -117,8 +142,6 @@ function! g:SyntasticChecker.setVersion(version) abort " {{{2
if len(a:version)
let self._version = copy(a:version)
call self.log(self.getExec() . ' version =', a:version)
else
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
endif
endfunction " }}}2
@ -152,6 +175,10 @@ function! g:SyntasticChecker.isAvailable() abort " {{{2
return self._available
endfunction " }}}2
function! g:SyntasticChecker.isDisabled() abort " {{{2
return has_key(self, '_enable') && syntastic#util#var(self._enable, -1) <= 0
endfunction " }}}2
function! g:SyntasticChecker.wantSort() abort " {{{2
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
endfunction " }}}2
@ -198,7 +225,7 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) abort " {{{2
for e in a:errors
if e['valid']
let term = self._highlightRegexFunc(e)
if term != ''
if term !=# ''
let e['hl'] = term
endif
endif

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_cursor") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_cursor') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_cursor = 1

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_highlighting") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_highlighting') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_highlighting = 1
@ -29,7 +29,7 @@ function! g:SyntasticHighlightingNotifier.enabled() abort " {{{2
return s:has_highlighting && syntastic#util#var('enable_highlighting')
endfunction " }}}2
" Sets error highlights in the cuirrent window
" Sets error highlights in the current window
function! g:SyntasticHighlightingNotifier.refresh(loclist) abort " {{{2
if self.enabled()
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_loclist") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_loclist') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_loclist = 1
@ -13,7 +13,7 @@ function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
for e in llist
if get(e, 'type', '') == ''
if get(e, 'type', '') ==# ''
let e['type'] = 'E'
endif
endfor
@ -28,7 +28,7 @@ function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.current() abort " {{{2
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist)
if !exists('b:syntastic_loclist') || empty(b:syntastic_loclist)
let b:syntastic_loclist = g:SyntasticLoclist.New([])
endif
return b:syntastic_loclist
@ -57,7 +57,7 @@ function! g:SyntasticLoclist.isEmpty() abort " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.isNewerThan(stamp) abort " {{{2
if !exists("self._stamp")
if !exists('self._stamp')
let self._stamp = []
return 0
endif
@ -81,10 +81,10 @@ function! g:SyntasticLoclist.getCursorColumns() abort " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
if !exists("self._stl_format")
if !exists('self._stl_format')
let self._stl_format = ''
endif
if !exists("self._stl_flag")
if !exists('self._stl_flag')
let self._stl_flag = ''
endif
@ -185,8 +185,8 @@ function! g:SyntasticLoclist.decorate(tag) abort " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.balloons() abort " {{{2
if !exists("self._cachedBalloons")
let sep = has("balloon_multiline") ? "\n" : ' | '
if !exists('self._cachedBalloons')
let sep = has('balloon_multiline') ? "\n" : ' | '
let self._cachedBalloons = {}
for e in self._rawLoclist
@ -208,15 +208,15 @@ function! g:SyntasticLoclist.balloons() abort " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.errors() abort " {{{2
if !exists("self._cachedErrors")
let self._cachedErrors = self.filter({'type': "E"})
if !exists('self._cachedErrors')
let self._cachedErrors = self.filter({'type': 'E'})
endif
return self._cachedErrors
endfunction " }}}2
function! g:SyntasticLoclist.warnings() abort " {{{2
if !exists("self._cachedWarnings")
let self._cachedWarnings = self.filter({'type': "W"})
if !exists('self._cachedWarnings')
let self._cachedWarnings = self.filter({'type': 'W'})
endif
return self._cachedWarnings
endfunction " }}}2
@ -229,7 +229,7 @@ endfunction " }}}2
" cache used by EchoCurrentError()
function! g:SyntasticLoclist.messages(buf) abort " {{{2
if !exists("self._cachedMessages")
if !exists('self._cachedMessages')
let self._cachedMessages = {}
let errors = self.errors() + self.warnings()
@ -304,9 +304,9 @@ function! g:SyntasticLoclist.show() abort " {{{2
if !self.isEmpty()
let num = winnr()
execute "lopen " . syntastic#util#var('loc_list_height')
execute 'lopen ' . syntastic#util#var('loc_list_height')
if num != winnr()
wincmd p
execute num . 'wincmd w'
endif
" try to find the loclist window and set w:quickfix_title
@ -320,7 +320,7 @@ function! g:SyntasticLoclist.show() abort " {{{2
" errors == getloclist(0) is the only somewhat safe way to
" achieve that
if strpart(title, 0, 16) ==# ':SyntasticCheck ' ||
\ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) )
\ ( (title ==# '' || title ==# ':setloclist()') && errors == getloclist(0) )
call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name)
call setbufvar(buf, 'syntastic_owner_buffer', self._owner)
endif

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_modemap") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_modemap') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_modemap = 1
@ -68,7 +68,7 @@ function! g:SyntasticModeMap.toggleMode() abort " {{{2
endfunction " }}}2
function! g:SyntasticModeMap.echoMode() abort " {{{2
echo "Syntastic: " . self._mode . " mode enabled"
echo 'Syntastic: ' . self._mode . ' mode enabled'
endfunction " }}}2
function! g:SyntasticModeMap.modeInfo(filetypes) abort " {{{2

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifiers") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifiers') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifiers = 1

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_registry") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_registry') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_registry = 1
@ -53,7 +53,9 @@ let s:_DEFAULT_CHECKERS = {
\ 'lua': ['luac'],
\ 'markdown': ['mdl'],
\ 'matlab': ['mlint'],
\ 'mercury': ['mmc'],
\ 'nasm': ['nasm'],
\ 'nix': ['nix'],
\ 'nroff': ['mandoc'],
\ 'objc': ['gcc'],
\ 'objcpp': ['gcc'],
@ -93,7 +95,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'yaml': ['jsyaml'],
\ 'z80': ['z80syntaxchecker'],
\ 'zpt': ['zptlint'],
\ 'zsh': ['zsh', 'shellcheck'],
\ 'zsh': ['zsh'],
\ }
lockvar! s:_DEFAULT_CHECKERS
@ -104,6 +106,7 @@ let s:_DEFAULT_FILETYPE_MAP = {
\ 'litcoffee': 'coffee',
\ 'mail': 'text',
\ 'mkd': 'markdown',
\ 'pe-puppet': 'puppet',
\ 'sgml': 'docbk',
\ 'sgmllnx': 'docbk',
\ }
@ -178,12 +181,18 @@ function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) abort " {{{2
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
endfunction " }}}2
" Same as getCheckers(), but keep only the checkers available. This runs the
" Same as getCheckers(), but keep only the available checkers. This runs the
" corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
endfunction " }}}2
" Same as getCheckers(), but keep only the checkers tyhat are available and
" disabled. This runs the corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersDisabled(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isDisabled() && v:val.isAvailable()')
endfunction " }}}2
function! g:SyntasticRegistry.getKnownFiletypes() abort " {{{2
let types = keys(s:_DEFAULT_CHECKERS)
@ -211,15 +220,18 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
if len(ft_list) != 1
let available = []
let active = []
let disabled = []
for ft in ft_list
call extend(available, map( self.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' ))
call extend(active, map( self.getCheckersAvailable(ft, []), 'ft . "/" . v:val.getName()' ))
call extend(disabled, map( self.getCheckersDisabled(ft, []), 'ft . "/" . v:val.getName()' ))
endfor
else
let ft = ft_list[0]
let available = self.getNamesOfAvailableCheckers(ft)
let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()')
let disabled = map(self.getCheckersDisabled(ft, []), 'v:val.getName()')
endif
let cnt = len(available)
@ -232,6 +244,13 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
let cklist = cnt ? join(active) : '-'
echomsg 'Currently enabled checker' . plural . ': ' . cklist
let cnt = len(disabled)
let plural = cnt != 1 ? 's' : ''
if len(disabled)
let cklist = join(sort(disabled))
echomsg 'Checker' . plural . ' disabled for security reasons: ' . cklist
endif
" Eclim feels entitled to mess with syntastic's variables {{{3
if exists(':EclimValidate') && get(g:, 'EclimFileTypeValidate', 1)
let disabled = filter(copy(ft_list), 's:_disabled_by_eclim(v:val)')
@ -284,7 +303,7 @@ function! g:SyntasticRegistry._loadCheckersFor(filetype) abort " {{{2
return
endif
execute "runtime! syntax_checkers/" . a:filetype . "/*.vim"
execute 'runtime! syntax_checkers/' . a:filetype . '/*.vim'
if !has_key(self._checkerMap, a:filetype)
let self._checkerMap[a:filetype] = {}

View File

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_signs") || !exists("g:loaded_syntastic_plugin")
if exists('g:loaded_syntastic_notifier_signs') || !exists('g:loaded_syntastic_plugin')
finish
endif
let g:loaded_syntastic_notifier_signs = 1
@ -107,7 +107,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) abort " {{{2
let sign_subtype = get(i, 'subtype', '')
let sign_type = 'Syntastic' . sign_subtype . sign_severity
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
execute 'sign place ' . s:next_sign_id . ' line=' . i['lnum'] . ' name=' . sign_type . ' buffer=' . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
endif
@ -119,7 +119,7 @@ endfunction " }}}2
function! g:SyntasticSignsNotifier._removeSigns(ids) abort " {{{2
if has('signs')
for s in reverse(copy(a:ids))
execute "sign unplace " . s
execute 'sign unplace ' . s
call remove(self._bufSignIds(), index(self._bufSignIds(), s))
endfor
endif
@ -127,7 +127,7 @@ endfunction " }}}2
" Get all the ids of the SyntaxError signs in the buffer
function! g:SyntasticSignsNotifier._bufSignIds() abort " {{{2
if !exists("b:syntastic_private_sign_ids")
if !exists('b:syntastic_private_sign_ids')
let b:syntastic_private_sign_ids = []
endif
return b:syntastic_private_sign_ids

View File

@ -37,7 +37,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
endif
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict

View File

@ -32,8 +32,8 @@ function! SyntaxCheckers_ada_gcc_GetLocList() dict
\ '%-G%f:%s:,' .
\ '%f:%l:%c: %m,' .
\ '%f:%l: %m',
\ 'main_flags': '-c -x ada -fsyntax-only',
\ 'header_flags': '-x ada',
\ 'main_flags': '-c -x ada -gnats',
\ 'header_flags': '-x ada -gnats',
\ 'header_names': '\.ads$' })
endfunction

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_apiblueprint_snowcrash_checker")
if exists('g:loaded_syntastic_apiblueprint_snowcrash_checker')
finish
endif
let g:loaded_syntastic_apiblueprint_snowcrash_checker = 1

View File

@ -25,7 +25,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_applescript_osacompile_checker")
if exists('g:loaded_syntastic_applescript_osacompile_checker')
finish
endif
let g:loaded_syntastic_applescript_osacompile_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_asciidoc_asciidoc_checker")
if exists('g:loaded_syntastic_asciidoc_asciidoc_checker')
finish
endif
let g:loaded_syntastic_asciidoc_asciidoc_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_bemhtml_bemhtmllint_checker")
if exists('g:loaded_syntastic_bemhtml_bemhtmllint_checker')
finish
endif

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_bro_bro_checker")
if exists('g:loaded_syntastic_bro_bro_checker')
finish
endif
let g:loaded_syntastic_bro_bro_checker = 1
@ -20,7 +20,7 @@ set cpo&vim
function! SyntaxCheckers_bro_bro_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m at or near "\zs[^"]\+\ze"')
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_bro_bro_IsAvailable() dict

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_checkpatch_checker")
if exists('g:loaded_syntastic_c_checkpatch_checker')
finish
endif
let g:loaded_syntastic_c_checkpatch_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_clang_check_checker")
if exists('g:loaded_syntastic_c_clang_check_checker')
finish
endif
let g:loaded_syntastic_c_clang_check_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_clang_tidy_checker")
if exists('g:loaded_syntastic_c_clang_tidy_checker')
finish
endif
let g:loaded_syntastic_c_clang_tidy_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_cppcheck_checker")
if exists('g:loaded_syntastic_c_cppcheck_checker')
finish
endif
let g:loaded_syntastic_c_cppcheck_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_oclint_checker")
if exists('g:loaded_syntastic_c_oclint_checker')
finish
endif
let g:loaded_syntastic_c_oclint_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_c_pc_lint_checker")
if exists('g:loaded_syntastic_c_pc_lint_checker')
finish
endif
let g:loaded_syntastic_c_pc_lint_checker = 1
@ -23,7 +23,7 @@ if !exists('g:syntastic_pc_lint_config_file')
endif
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
let config = findfile(g:syntastic_pc_lint_config_file, '.;')
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
call self.log('config =', config)
" -hFs1 - show filename, add space after messages, try to make message 1 line

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_sparse_checker")
if exists('g:loaded_syntastic_c_sparse_checker')
finish
endif
let g:loaded_syntastic_c_sparse_checker = 1
@ -33,7 +33,7 @@ function! SyntaxCheckers_c_sparse_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
return loclist
endfunction

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_splint_checker")
if exists('g:loaded_syntastic_c_splint_checker')
finish
endif
let g:loaded_syntastic_c_splint_checker = 1

View File

@ -20,11 +20,11 @@ set cpo&vim
function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+")
if field != ''
if field !=# ''
return '\v\c^\s*' . field . '\s*:\s*\zs.*$'
endif
let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'")
if field != ''
if field !=# ''
return '\V\c\<' . escape(field, '\') . '\>'
endif
return ''

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_chef_foodcritic_checker")
if exists('g:loaded_syntastic_chef_foodcritic_checker')
finish
endif
let g:loaded_syntastic_chef_foodcritic_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_co_coco_checker")
if exists('g:loaded_syntastic_co_coco_checker')
finish
endif
let g:loaded_syntastic_co_coco_checker = 1

View File

@ -13,7 +13,7 @@
" Note: this script requires CoffeeScript version 1.6.2 or newer.
"
if exists("g:loaded_syntastic_coffee_coffee_checker")
if exists('g:loaded_syntastic_coffee_coffee_checker')
finish
endif
let g:loaded_syntastic_coffee_coffee_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_coffee_coffeelint_checker")
if exists('g:loaded_syntastic_coffee_coffeelint_checker')
finish
endif
let g:loaded_syntastic_coffee_coffeelint_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_coq_coqtop_checker")
if exists('g:loaded_syntastic_coq_coqtop_checker')
finish
endif
let g:loaded_syntastic_coq_coqtop_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_clang_check_checker")
if exists('g:loaded_syntastic_cpp_clang_check_checker')
finish
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_clang_tidy_checker")
if exists('g:loaded_syntastic_cpp_clang_tidy_checker')
finish
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_cppcheck_checker")
if exists('g:loaded_syntastic_cpp_cppcheck_checker')
finish
endif
let g:loaded_syntastic_cpp_cppcheck_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cpp_cpplint_checker")
if exists('g:loaded_syntastic_cpp_cpplint_checker')
finish
endif
let g:loaded_syntastic_cpp_cpplint_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_cpp_oclint_checker")
if exists('g:loaded_syntastic_cpp_oclint_checker')
finish
endif
let g:loaded_syntastic_cpp_oclint_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cpp_pc_lint_checker")
if exists('g:loaded_syntastic_cpp_pc_lint_checker')
finish
endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1

View File

@ -0,0 +1,48 @@
"============================================================================
"File: verapp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Lucas Verney <phyks@phyks.me>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" Tested with Vera++ 1.3.0
"============================================================================
if exists('g:loaded_syntastic_cpp_verapp_checker')
finish
endif
let g:loaded_syntastic_cpp_verapp_checker = 1
if !exists('g:syntastic_verapp_config_file')
let g:syntastic_verapp_config_file = '.syntastic_verapp_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_verapp_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': syntastic#c#ReadConfig(g:syntastic_verapp_config_file),
\ 'args_after': '--show-rule --no-duplicate -S -c -' })
let errorformat = '%f:%t:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'checkstyle',
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'verapp',
\ 'exec': 'vera++'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cs_mcs_checker")
if exists('g:loaded_syntastic_cs_mcs_checker')
finish
endif
let g:loaded_syntastic_cs_mcs_checker = 1
@ -26,7 +26,7 @@ function! SyntaxCheckers_cs_mcs_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -33,7 +33,7 @@ function! SyntaxCheckers_css_csslint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_css_phpcs_checker")
if exists('g:loaded_syntastic_css_phpcs_checker')
finish
endif
let g:loaded_syntastic_css_phpcs_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_css_prettycss_checker")
if exists('g:loaded_syntastic_css_prettycss_checker')
finish
endif
let g:loaded_syntastic_css_prettycss_checker = 1
@ -23,8 +23,8 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$')
if term != ''
let term = matchstr(a:item['text'], '\m (\zs[^)]\+\ze)$')
if term !=# ''
let term = '\V' . escape(term, '\')
endif
return term
@ -42,10 +42,10 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
for e in loclist
let e["text"] .= ')'
let e['text'] .= ')'
endfor
return loclist

View File

@ -11,7 +11,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_css_recess_checker")
if exists('g:loaded_syntastic_css_recess_checker')
finish
endif
let g:loaded_syntastic_css_recess_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cucumber_cucumber_checker")
if exists('g:loaded_syntastic_cucumber_cucumber_checker')
finish
endif
let g:loaded_syntastic_cucumber_cucumber_checker = 1

View File

@ -6,7 +6,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_cuda_nvcc_checker")
if exists('g:loaded_syntastic_cuda_nvcc_checker')
finish
endif
let g:loaded_syntastic_cuda_nvcc_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_dart_dartanalyzer_checker")
if exists('g:loaded_syntastic_dart_dartanalyzer_checker')
finish
endif
let g:loaded_syntastic_dart_dartanalyzer_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_docbk_xmllint_checker")
if exists('g:loaded_syntastic_docbk_xmllint_checker')
finish
endif
let g:loaded_syntastic_docbk_xmllint_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_dustjs_swiffer_checker")
if exists('g:loaded_syntastic_dustjs_swiffer_checker')
finish
endif

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_elixir_elixir_checker")
if exists('g:loaded_syntastic_elixir_elixir_checker')
finish
endif
let g:loaded_syntastic_elixir_elixir_checker = 1
@ -27,15 +27,9 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
endfunction
function! SyntaxCheckers_elixir_elixir_GetLocList() dict
if !exists('g:syntastic_enable_elixir_checker') || !g:syntastic_enable_elixir_checker
call syntastic#log#error('checker elixir/elixir: checks disabled for security reasons; ' .
\ 'set g:syntastic_enable_elixir_checker to 1 to override')
return []
endif
let make_options = {}
let compile_command = 'elixir'
let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h', 1))
let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1))
if filereadable(mix_file)
let compile_command = 'mix compile'
@ -53,7 +47,8 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'elixir',
\ 'name': 'elixir'})
\ 'name': 'elixir',
\ 'enable': 'enable_elixir_checker'})
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -1,56 +1,73 @@
#!/usr/bin/env escript
-export([main/1]).
main([FileName]) ->
LibDirs = (["ebin", "include", "src", "test"] ++
filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")),
compile(FileName, LibDirs);
main([File]) ->
Dir = get_root(filename:dirname(File)),
Defs = [strong_validation,
warn_export_all,
warn_export_vars,
warn_shadow_vars,
warn_obsolete_guard,
warn_unused_import,
report,
{i, Dir ++ "/include"}],
%% `rebar.config` is looked for,
%% but it is not necessarily the one in the project root.
%% I.e. it may be one deeper in the project file hierarchy.
RebarFile = rebar_file(Dir),
%% `rebar.config` might contain relative paths.
%% They are relative to the file! Not to the project root.
RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile),
code:add_patha(filename:absname("ebin")),
%% `compile:file/2` requires the `{i, Path}` to be relative
%% to CWD - no surprise here.
compile:file(File, Defs ++ translate_paths(Dir, RebarOpts));
main([FileName, "-rebar", Path, LibDirs]) ->
{ok, L} = file:consult(Path),
P = dict:from_list(L),
Root = filename:dirname(Path),
main(_) ->
io:format("Usage: ~s <file>~n", [escript:script_name()]),
halt(1).
Lib1 = case dict:find(lib_dirs, P) of
{ok, X} -> lists:map(fun(Sub) -> Root ++ "/" ++ Sub end, X);
_ -> []
end,
rebar_file(Dir) ->
DirList = filename:split(Dir),
case lists:last(DirList) of
"test" ->
"rebar.test.config";
_ ->
"rebar.config"
end.
Lib2 = case dict:find(sub_dirs, P) of
{ok, Y} -> lists:foldl(
fun(Sub,Sofar) ->
Sofar ++ [
Root ++ "/" ++ Sub,
Root ++ "/" ++ Sub ++ "/include",
Root ++ "/" ++ Sub ++ "/deps",
Root ++ "/" ++ Sub ++ "/lib"
] end, [], Y);
_ -> []
end,
rebar_opts(RebarFile) ->
Dir = get_root(filename:dirname(RebarFile)),
case file:consult(RebarFile) of
{ok, Terms} ->
RebarLibDirs = proplists:get_value(lib_dirs, Terms, []),
lists:foreach(
fun(LibDir) ->
code:add_pathsa(filelib:wildcard(LibDir ++ "/*/ebin"))
end, RebarLibDirs),
RebarDepsDir = proplists:get_value(deps_dir, Terms, "deps"),
code:add_pathsa(filelib:wildcard(RebarDepsDir ++ "/*/ebin")),
IncludeDeps = {i, filename:join(Dir, RebarDepsDir)},
proplists:get_value(erl_opts, Terms, []) ++ [IncludeDeps];
{error, _} when RebarFile == "rebar.config" ->
fallback_opts();
{error, _} ->
rebar_opts("rebar.config")
end.
LibDirs1 = LibDirs ++ Lib1 ++ Lib2,
%io:format("~p~n", [LibDirs1]),
compile(FileName, LibDirs1);
fallback_opts() ->
code:add_pathsa(filelib:wildcard("deps/*/ebin")),
code:add_pathsa(nested_app_ebins()),
[
{ i, filename:absname("apps") }, { i, filename:absname("deps") } | [ { i, filename:absname(Path) } || Path <- filelib:wildcard("deps/*/apps")]
].
main([FileName | LibDirs]) ->
compile(FileName, LibDirs).
nested_app_ebins() ->
DetectedAppSrcFiles = filelib:wildcard("deps/*/apps/**/*.app.src"),
[apps_dir_from_src(AppSrcFile)||AppSrcFile<-DetectedAppSrcFiles].
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, I)} || I <- LibDirs] ++
case lists:member("deps/pmod_transform/include", LibDirs) of
true -> [{parse_transform, pmod_pt}];
_ -> []
end
).
apps_dir_from_src(SrcFile) ->
SrcDir = filename:dirname(SrcFile),
filename:join(SrcDir, "../../ebin").
get_root(Dir) ->
Path = filename:split(filename:absname(Dir)),
@ -64,3 +81,15 @@ get_root(["test" | Tail], _Path) ->
lists:reverse(Tail);
get_root([_ | Tail], Path) ->
get_root(Tail, Path).
translate_paths(Dir, RebarOpts) ->
[ translate_path(Dir, Opt) || Opt <- RebarOpts ].
translate_path(Dir, {i, Path}) ->
case Path of
%% absolute
"/" ++ _ -> {i, Path};
%% relative -> make absolute taking rebar.config location into account
_ -> {i, filename:join([Dir, Path])}
end;
translate_path(_, Other) -> Other.

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_erlang_syntaxerl_checker")
if exists('g:loaded_syntastic_erlang_syntaxerl_checker')
finish
endif

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_eruby_ruby_checker")
if exists('g:loaded_syntastic_eruby_ruby_checker')
finish
endif
let g:loaded_syntastic_eruby_ruby_checker = 1
@ -35,7 +35,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
" TODO: encodings became useful in ruby 1.9 :)
if s:ruby_new
let enc = &fileencoding != '' ? &fileencoding : &encoding
let enc = &fileencoding !=# '' ? &fileencoding : &encoding
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
else
let encoding_spec = ''
@ -69,7 +69,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } })
\ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -10,37 +10,84 @@
"
"============================================================================
if exists("g:loaded_syntastic_fortran_gfortran_checker")
if exists('g:loaded_syntastic_fortran_gfortran_checker')
finish
endif
let g:loaded_syntastic_fortran_gfortran_checker=1
let g:loaded_syntastic_fortran_gfortran_checker = 1
if !exists('g:syntastic_fortran_compiler_options')
let g:syntastic_fortran_compiler_options = ''
endif
let s:type_map = {}
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict
function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict " {{{1
if !exists('g:syntastic_fortran_compiler')
let g:syntastic_fortran_compiler = self.getExec()
endif
call self.log('g:syntastic_fortran_compiler = ', g:syntastic_fortran_compiler)
return executable(expand(g:syntastic_fortran_compiler, 1))
endfunction
endfunction " }}}1
" @vimlint(EVL104, 1, l:errorformat)
function! SyntaxCheckers_fortran_gfortran_GetLocList() dict " {{{1
call s:SetCompilerType(g:syntastic_fortran_compiler)
if !has_key(s:type_map, g:syntastic_fortran_compiler)
call syntastic#log#error("checker fortran/gfortran: can't parse version string (abnormal termination?)")
return []
endif
if s:type_map[g:syntastic_fortran_compiler] ==# 'gfortran'
let errorformat =
\ '%-C %#,'.
\ '%-C %#%.%#,'.
\ '%A%f:%l%[.:]%c:,'.
\ '%Z%\m%\%%(Fatal %\)%\?%trror: %m,'.
\ '%Z%tarning: %m,'.
\ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')
let g:syntastic_fortran_gfortran_sort = 0
endif
elseif s:type_map[g:syntastic_fortran_compiler] ==# 'ifort'
let errorformat =
\ '%E%f(%l): error #%n: %m,'.
\ '%W%f(%l): warning #%n: %m,'.
\ '%W%f(%l): remark #%n: %m,'.
\ '%-Z%p^,'.
\ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')
let g:syntastic_fortran_gfortran_sort = 1
endif
endif
function! SyntaxCheckers_fortran_gfortran_GetLocList() dict
return syntastic#c#GetLocList('fortran', 'gfortran', {
\ 'errorformat':
\ '%-C %#,'.
\ '%-C %#%.%#,'.
\ '%A%f:%l.%c:,'.
\ '%Z%trror: %m,'.
\ '%Z%tarning: %m,'.
\ '%-G%.%#',
\ 'errorformat': errorformat,
\ 'main_flags': '-fsyntax-only' })
endfunction
endfunction " }}}1
" @vimlint(EVL104, 0, l:errorformat)
" Utilities {{{1
function! s:SetCompilerType(exe) " {{{2
if !has_key(s:type_map, a:exe)
try
let ver = filter( split(syntastic#util#system(syntastic#util#shescape(a:exe) . ' --version'), '\n'),
\ 'v:val =~# "\\v^%(GNU Fortran|ifort) "' )[0]
if ver =~# '\m^GNU Fortran '
let s:type_map[a:exe] = 'gfortran'
elseif ver =~# '\m^ifort '
let s:type_map[a:exe] = 'ifort'
endif
catch /\m^Vim\%((\a\+)\)\=:E684/
" do nothing
endtry
endif
endfunction " }}}2
" }}}
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'fortran',

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_glsl_cgc_checker")
if exists('g:loaded_syntastic_glsl_cgc_checker')
finish
endif
let g:loaded_syntastic_glsl_cgc_checker = 1
@ -33,8 +33,8 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1
\ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') })
let errorformat =
\ "%E%f(%l) : error %m," .
\ "%W%f(%l) : warning %m"
\ '%E%f(%l) : error %m,' .
\ '%W%f(%l) : warning %m'
return SyntasticMake({
\ 'makeprg': makeprg,

View File

@ -14,7 +14,7 @@
" Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
if exists("g:loaded_syntastic_go_go_checker")
if exists('g:loaded_syntastic_go_go_checker')
finish
endif
let g:loaded_syntastic_go_go_checker = 1
@ -58,8 +58,8 @@ function! SyntaxCheckers_go_go_GetLocList() dict
let opts = syntastic#util#var('go_go_test_args')
let cleanup = 1
endif
let opt_str = (type(opts) != type('') || opts != '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str . ' ' . syntastic#c#NullOutput()
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str
" The first pattern is for warnings from C compilers.
let errorformat =

View File

@ -14,7 +14,7 @@
" Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
if exists("g:loaded_syntastic_go_gofmt_checker")
if exists('g:loaded_syntastic_go_gofmt_checker')
finish
endif
let g:loaded_syntastic_go_gofmt_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_go_golint_checker")
if exists('g:loaded_syntastic_go_golint_checker')
finish
endif
let g:loaded_syntastic_go_golint_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_go_gotype_checker")
if exists('g:loaded_syntastic_go_gotype_checker')
finish
endif
let g:loaded_syntastic_go_gotype_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_go_govet_checker")
if exists('g:loaded_syntastic_go_govet_checker')
finish
endif
let g:loaded_syntastic_go_govet_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_haml_haml_lint_checker")
if exists('g:loaded_syntastic_haml_haml_lint_checker')
finish
endif
let g:loaded_syntastic_haml_haml_lint_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_handlebars_handlebars_checker")
if exists('g:loaded_syntastic_handlebars_handlebars_checker')
finish
endif
let g:loaded_syntastic_handlebars_handlebars_checker = 1
@ -21,8 +21,8 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-f ' . syntastic#util#DevNull() })
let errorformat =
\ '%EError: %m on line %l:,'.
\ "%EError: %m,".
\ '%EError: %m on line %l:,' .
\ '%EError: %m,' .
\ '%Z%p^,' .
\ '%-G%.%#'
@ -30,7 +30,7 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -30,20 +30,23 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
" know the version in order to know how to find out the version. :)
" Try "ghc-mod version".
let ver = filter(split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\sversion''')
if !len(ver)
" That didn't work. Try "ghc-mod" alone.
let ver = filter(split(syntastic#util#system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
let version_output = split(syntastic#util#system(self.getExecEscaped()), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\sversion''')
endif
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0]) : []
if len(ver)
if len(parsed_ver)
" Encouraged by the great success in finding out the version, now we
" need either a Vim that can handle NULs in system() output, or a
" ghc-mod that has the "--boundary" option.
let parsed_ver = syntastic#util#parseVersion(ver[0])
call self.setVersion(parsed_ver)
let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2])
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', version_output)
call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
let s:ghc_mod_new = -1
endif
@ -68,6 +71,7 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'iconv',
\ 'postprocess': ['compressWhitespace'],
\ 'returns': [0] })
endfunction

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_haskell_hdevtools_checker")
if exists('g:loaded_syntastic_haskell_hdevtools_checker')
finish
endif
let g:loaded_syntastic_haskell_hdevtools_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_haxe_haxe_checker")
if exists('g:loaded_syntastic_haxe_haxe_checker')
finish
endif
let g:loaded_syntastic_haxe_haxe_checker = 1
@ -24,13 +24,13 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
elseif exists('g:vaxe_hxml')
let hxml = g:vaxe_hxml
else
let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h', 1))
let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1))
endif
let hxml = fnamemodify(hxml, ':p')
call self.log('hxml =', hxml)
if hxml != ''
if hxml !=# ''
let makeprg = self.makeprgBuild({
\ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) })

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_hss_hss_checker")
if exists('g:loaded_syntastic_hss_hss_checker')
finish
endif
let g:loaded_syntastic_hss_hss_checker = 1

View File

@ -9,16 +9,8 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Note: if you need to check HTML5 sources, you might consider installing a
" fork of HTML Tidy, named "HTML Tidy for HTML5":
"
" http://w3c.github.io/tidy-html5/
"
" HTML Tidy for HTML5 can be used without changes by this checker, just install
" it and point g:syntastic_html_tidy_exec to the executable.
if exists("g:loaded_syntastic_html_tidy_checker")
if exists('g:loaded_syntastic_html_tidy_checker')
finish
endif
let g:loaded_syntastic_html_tidy_checker = 1
@ -102,40 +94,40 @@ let s:IGNORE_ERRORS = [
lockvar! s:IGNORE_ERRORS
let s:BLOCKLEVEL_TAGS = [
\ "main",
\ "section",
\ "article",
\ "aside",
\ "header",
\ "footer",
\ "nav",
\ "figure",
\ "figcaption"
\ 'main',
\ 'section',
\ 'article',
\ 'aside',
\ 'header',
\ 'footer',
\ 'nav',
\ 'figure',
\ 'figcaption'
\ ]
lockvar! s:BLOCKLEVEL_TAGS
let s:INLINE_TAGS = [
\ "video",
\ "audio",
\ "source",
\ "embed",
\ "mark",
\ "progress",
\ "meter",
\ "time",
\ "ruby",
\ "rt",
\ "rp",
\ "canvas",
\ "command",
\ "details",
\ "datalist"
\ 'video',
\ 'audio',
\ 'source',
\ 'embed',
\ 'mark',
\ 'progress',
\ 'meter',
\ 'time',
\ 'ruby',
\ 'rt',
\ 'rp',
\ 'canvas',
\ 'command',
\ 'details',
\ 'datalist'
\ ]
lockvar! s:INLINE_TAGS
let s:EMPTY_TAGS = [
\ "wbr",
\ "keygen"
\ 'wbr',
\ 'keygen'
\ ]
lockvar! s:EMPTY_TAGS
@ -152,7 +144,7 @@ function! SyntaxCheckers_html_tidy_GetLocList() dict " {{{1
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1, 2] })
" filter out valid HTML5 from the errors

View File

@ -10,13 +10,13 @@
"
"============================================================================
if exists("g:loaded_syntastic_html_validator_checker")
if exists('g:loaded_syntastic_html_validator_checker')
finish
endif
let g:loaded_syntastic_html_validator_checker=1
if !exists('g:syntastic_html_validator_api')
let g:syntastic_html_validator_api = 'http://validator.nu/'
let g:syntastic_html_validator_api = 'https://validator.nu/'
endif
if !exists('g:syntastic_html_validator_parser')
@ -32,9 +32,9 @@ set cpo&vim
function! SyntaxCheckers_html_validator_GetLocList() dict
let fname = syntastic#util#shexpand('%')
let makeprg = self.getExecEscaped() . ' -q -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (g:syntastic_html_validator_parser != '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (g:syntastic_html_validator_nsfilter != '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
\ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api
let errorformat =

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_html_w3_checker")
if exists('g:loaded_syntastic_html_w3_checker')
finish
endif
let g:loaded_syntastic_html_w3_checker = 1
@ -23,7 +23,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_html_w3_GetLocList() dict
let makeprg = self.getExecEscaped() . ' -q -s -F output=json ' .
let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' .
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
\ g:syntastic_html_w3_api
@ -41,7 +41,7 @@ function! SyntaxCheckers_html_w3_GetLocList() dict
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0] })
for e in loclist

View File

@ -11,16 +11,16 @@
" Tested with checkstyle 5.5
"============================================================================
if exists("g:loaded_syntastic_java_checkstyle_checker")
if exists('g:loaded_syntastic_java_checkstyle_checker')
finish
endif
let g:loaded_syntastic_java_checkstyle_checker = 1
if !exists("g:syntastic_java_checkstyle_classpath")
if !exists('g:syntastic_java_checkstyle_classpath')
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
endif
if !exists("g:syntastic_java_checkstyle_conf_file")
if !exists('g:syntastic_java_checkstyle_conf_file')
let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml'
endif

View File

@ -73,6 +73,17 @@ endif
" }}}1
" Constants {{{1
let s:_FILE_SHORTCUTS = {
\ '%FILE_PATH%': '%:p',
\ '%FILE_NAME%': '%:t',
\ '%FILE_DIR%': '%:p:h',
\ }
lockvar! s:_FILE_SHORTCUTS
" }}}1
command! SyntasticJavacEditClasspath call s:EditClasspath()
if g:syntastic_java_javac_config_file_enabled
@ -103,7 +114,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let javac_classpath = ''
for path in split(g:syntastic_java_javac_classpath, s:ClassSep())
if path != ''
if path !=# ''
try
let ps = glob(path, 1, 1)
catch
@ -128,8 +139,13 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" }}}2
" load custom classpath {{{2
if g:syntastic_java_javac_custom_classpath_command != ''
let lines = syntastic#util#system(g:syntastic_java_javac_custom_classpath_command)
if g:syntastic_java_javac_custom_classpath_command !=# ''
" Pre-process the classpath command string a little.
let classpath_command = g:syntastic_java_javac_custom_classpath_command
for [key, val] in items(s:_FILE_SHORTCUTS)
let classpath_command = substitute(classpath_command, '\V' . key, syntastic#util#shexpand(val), 'g')
endfor
let lines = syntastic#util#system(classpath_command)
if syntastic#util#isRunningWindows() || has('win32unix')
let lines = substitute(lines, "\r\n", "\n", 'g')
endif
@ -138,7 +154,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
endfor
endif
if javac_classpath != ''
if javac_classpath !=# ''
let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath)
endif
" }}}2
@ -162,7 +178,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
\ '%+C%.%#,'.
\ '%-G%.%#'
if output_dir != ''
if output_dir !=# ''
silent! call mkdir(output_dir, 'p')
endif
let errors = SyntasticMake({
@ -170,7 +186,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
\ 'errorformat': errorformat,
\ 'postprocess': ['cygwinRemoveCR'] })
if output_dir != ''
if output_dir !=# ''
call syntastic#util#rmrf(output_dir)
endif
return errors
@ -188,10 +204,10 @@ function! s:ClassSep() " {{{2
endfunction " }}}2
function! s:AddToClasspath(classpath, path) " {{{2
if a:path == ''
if a:path ==# ''
return a:classpath
endif
return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path
return (a:classpath !=# '') ? a:classpath . s:ClassSep() . a:path : a:path
endfunction " }}}2
function! s:SplitClasspath(classpath) " {{{2
@ -299,7 +315,7 @@ endfunction " }}}2
function! s:GetMavenProperties() " {{{2
let mvn_properties = {}
let pom = findfile('pom.xml', '.;')
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
@ -334,7 +350,7 @@ function! s:GetMavenProperties() " {{{2
endfunction " }}}2
function! s:GetMavenClasspath() " {{{2
let pom = findfile('pom.xml', '.;')
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
@ -378,7 +394,7 @@ function! s:GetMavenClasspath() " {{{2
endfunction " }}}2
function! s:MavenOutputDirectory() " {{{2
let pom = findfile('pom.xml', '.;')
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
let mvn_properties = s:GetMavenProperties()
let output_dir = getcwd()

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_closurecompiler_checker")
if exists('g:loaded_syntastic_javascript_closurecompiler_checker')
finish
endif
let g:loaded_syntastic_javascript_closurecompiler_checker = 1

View File

@ -21,9 +21,20 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_flow_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 6])
endfunction
function! SyntaxCheckers_javascript_flow_GetLocList() dict
if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# ''
return []
endif
let makeprg = self.makeprgBuild({
\ 'exe': self.getExecEscaped() . ' check',
\ 'exe': self.getExecEscaped() . ' status',
\ 'args_after': '--show-all-errors --json' })
let errorformat =

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_gjslint_checker")
if exists('g:loaded_syntastic_javascript_gjslint_checker')
finish
endif
let g:loaded_syntastic_javascript_gjslint_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_jscs_checker")
if exists('g:loaded_syntastic_javascript_jscs_checker')
finish
endif
let g:loaded_syntastic_javascript_jscs_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_jsl_checker")
if exists('g:loaded_syntastic_javascript_jsl_checker')
finish
endif
let g:loaded_syntastic_javascript_jsl_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_javascript_jslint_checker")
if exists('g:loaded_syntastic_javascript_jslint_checker')
finish
endif
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
if term != ''
if term !=# ''
let term = '\V\<' . escape(term, '\') . '\>'
endif
return term
@ -38,7 +38,7 @@ function! SyntaxCheckers_javascript_jslint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -18,15 +18,16 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = syntastic#util#system(self.getExecEscaped() . ' --version')
if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>')
return 0
let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
let parsed_ver = !v:shell_error && (version_output =~# '\m^JSXHint\>') ? syntastic#util#parseVersion(version_output) : []
if len(parsed_ver)
call self.setVersion(parsed_ver)
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker javascript/jsxhint: can't parse version string (abnormal termination?)")
endif
let ver = syntastic#util#parseVersion(jsxhint_version)
call self.setVersion(ver)
return syntastic#util#versionIsAtLeast(ver, [0, 4, 1])
return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1])
endfunction
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_standard_checker")
if exists('g:loaded_syntastic_javascript_standard_checker')
finish
endif
let g:loaded_syntastic_javascript_standard_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_json_jsonlint_checker")
if exists('g:loaded_syntastic_json_jsonlint_checker')
finish
endif
let g:loaded_syntastic_json_jsonlint_checker = 1

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_json_jsonval_checker")
if exists('g:loaded_syntastic_json_jsonval_checker')
finish
endif
let g:loaded_syntastic_json_jsonval_checker = 1

View File

@ -10,16 +10,16 @@
"
"============================================================================
if exists("g:loaded_syntastic_less_lessc_checker")
if exists('g:loaded_syntastic_less_lessc_checker')
finish
endif
let g:loaded_syntastic_less_lessc_checker = 1
if !exists("g:syntastic_less_options")
let g:syntastic_less_options = ""
if !exists('g:syntastic_less_options')
let g:syntastic_less_options = ''
endif
if !exists("g:syntastic_less_use_less_lint")
if !exists('g:syntastic_less_use_less_lint')
let g:syntastic_less_use_less_lint = 0
endif
@ -53,7 +53,7 @@ function! SyntaxCheckers_less_lessc_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
\ 'defaults': {'bufnr': bufnr(''), 'text': 'Syntax error'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_lex_flex_checker")
if exists('g:loaded_syntastic_lex_flex_checker')
finish
endif
let g:loaded_syntastic_lex_flex_checker = 1
@ -21,12 +21,12 @@ set cpo&vim
function! SyntaxCheckers_lex_flex_GetHighlightRegex(item)
let term = matchstr(a:item['text'],
\ '\m^\(unrecognized %option\|bad <start condition>\|bad character\( class expression\)\=\): \zs.*')
if term == ''
if term ==# ''
let term = matchstr(a:item['text'],
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
endif
return term != '' ? '\V' . escape(term, '\') : ''
return term !=# '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_lex_flex_GetLocList() dict

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_limbo_limbo_checker")
if exists('g:loaded_syntastic_limbo_limbo_checker')
finish
endif
let g:loaded_syntastic_limbo_limbo_checker = 1
@ -19,7 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_limbo_limbo_GetLocList() dict
let include = $INFERNO_HOME != '' ? '-I$INFERNO_HOME ' : ''
let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : ''
" don't generate .dis in current dir while checking syntax,
" .dis should be generated by `mk`
let output = filereadable('mkfile') ? (' ' . syntastic#c#NullOutput()) : ''

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_lisp_clisp_checker")
if exists('g:loaded_syntastic_lisp_clisp_checker')
finish
endif
let g:loaded_syntastic_lisp_clisp_checker = 1
@ -20,7 +20,7 @@ set cpo&vim
function! SyntaxCheckers_lisp_clisp_GetLocList() dict
let tmpdir = syntastic#util#tmpdir()
let out = tmpdir != '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : ''
let out = tmpdir !=# '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : ''
let makeprg = self.makeprgBuild({
\ 'args_after': '-q',

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_llvm_llvm_checker")
if exists('g:loaded_syntastic_llvm_llvm_checker')
finish
endif
let g:loaded_syntastic_llvm_llvm_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_lua_luac_checker")
if exists('g:loaded_syntastic_lua_luac_checker')
finish
endif
let g:loaded_syntastic_lua_luac_checker = 1
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
let result = ''
let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''')
if near != ''
if near !=# ''
if near ==# '<eof>'
let p = getpos('$')
let a:pos['lnum'] = p[1]

View File

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_lua_luacheck_checker")
if exists('g:loaded_syntastic_lua_luacheck_checker')
finish
endif
let g:loaded_syntastic_lua_luacheck_checker = 1
@ -19,27 +19,27 @@ set cpo&vim
function! SyntaxCheckers_lua_luacheck_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m''\zs\S\+\ze''')
if term != ''
if term !=# ''
return '\V\<' . escape(term, '\') . '\>'
endif
let term = matchstr(a:item['text'], '\m\(accessing undefined\|setting non-standard global\|' .
\ 'setting non-module global\|unused global\) variable \zs\S\+')
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze was previously defined')
endif
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\munused \(variable\|argument\|loop variable\) \zs\S\+')
endif
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\m\(value assigned to variable\|value of argument\|' .
\ 'value of loop variable\) \zs\S\+')
endif
if term == ''
if term ==# ''
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze is never set')
endif
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_lua_luacheck_GetLocList() dict

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_markdown_mdl_checker")
if exists('g:loaded_syntastic_markdown_mdl_checker')
finish
endif
let g:loaded_syntastic_markdown_mdl_checker = 1

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_matlab_mlint_checker")
if exists('g:loaded_syntastic_matlab_mlint_checker')
finish
endif
let g:loaded_syntastic_matlab_mlint_checker = 1
@ -28,7 +28,7 @@ function! SyntaxCheckers_matlab_mlint_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -0,0 +1,49 @@
"============================================================================
"File: mercury.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Joshua Rahm (joshuarahm@gmail.com)
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_mercury_mmc_checker')
finish
endif
let g:loaded_syntastic_mercury_mmc_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_mercury_mmc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '-e' })
let errorformat =
\ '%C%f:%l: %m,' .
\ '%E%f:%l: %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
for e in loclist
if stridx(e['text'], ' warning:') >= 0
let e['type'] = 'W'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'mercury',
\ 'name': 'mmc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -10,7 +10,7 @@
"
"============================================================================
if exists("g:loaded_syntastic_nasm_nasm_checker")
if exists('g:loaded_syntastic_nasm_nasm_checker')
finish
endif
let g:loaded_syntastic_nasm_nasm_checker = 1

View File

@ -0,0 +1,44 @@
"============================================================================
"File: nix.vim
"Description: Check nix syntax using 'nix-instantiate --eval-only'
"Maintainer: Tim Cuthbertson <tim@gfxmonk.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
"
if exists('g:loaded_syntastic_nix_nix_checker')
finish
endif
let g:loaded_syntastic_nix_nix_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_nix_nix_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--parse-only' })
let errorformat =
\ '%m\, at %f:%l:%c,' .
\ '%m at %f\, line %l:,' .
\ 'error: %m\, in %f'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nix',
\ 'name': 'nix',
\ 'exec': 'nix-instantiate' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

Some files were not shown because too many files have changed in this diff Show More