mirror of
https://github.com/amix/vimrc
synced 2025-06-23 23:15:01 +08:00
Updated plugins
This commit is contained in:
@ -35,16 +35,16 @@ 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, syntax checking plugins exist for ActionScript,
|
||||
Ada, 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, MATLAB, NASM, Objective-C, Objective-C++,
|
||||
OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property
|
||||
lists, Puppet, Python, Racket, R, reStructuredText, Ruby, SASS/SCSS, Scala,
|
||||
Slim, 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.
|
||||
Ada, AppleScript, Arduino, 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, MATLAB, NASM, Objective-C,
|
||||
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X
|
||||
and iOS property lists, Puppet, Python, Racket, R, reStructuredText, Ruby,
|
||||
SASS/SCSS, Scala, Slim, 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.
|
||||
|
||||
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
|
||||
@ -137,7 +137,8 @@ statements in your file (cf. [perlrun][10]). This is probably fine if you
|
||||
wrote the file yourself, but it's a security problem if you're checking third
|
||||
party files. Since there is currently no way to disable this behaviour while
|
||||
still producing useful results, the checker is now disabled by default. To
|
||||
(re-)enable it, set `g:syntastic_enable_perl_checker` to 1 in your vimrc:
|
||||
(re-)enable it, make sure the `g:syntastic_perl_checkers` list includes `perl`,
|
||||
and set `g:syntastic_enable_perl_checker` to 1 in your vimrc:
|
||||
```vim
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
```
|
||||
|
@ -154,17 +154,10 @@ function! s:logRedirect(on) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:logTimestamp_smart() " {{{2
|
||||
function! s:logTimestamp() " {{{2
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': '
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:logTimestamp_dumb() " {{{2
|
||||
return 'syntastic: debug: '
|
||||
endfunction " }}}2
|
||||
|
||||
let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb')
|
||||
lockvar s:logTimestamp
|
||||
|
||||
function! s:formatVariable(name) " {{{2
|
||||
let vals = []
|
||||
if exists('g:syntastic_' . a:name)
|
||||
|
@ -35,12 +35,12 @@ endfunction " }}}2
|
||||
"
|
||||
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||
function! syntastic#util#parseShebang() " {{{2
|
||||
for lnum in range(1,5)
|
||||
for lnum in range(1, 5)
|
||||
let line = getline(lnum)
|
||||
|
||||
if line =~ '^#!'
|
||||
let exe = matchstr(line, '\m^#!\s*\zs[^ \t]*')
|
||||
let args = split(matchstr(line, '\m^#!\s*[^ \t]*\zs.*'))
|
||||
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.*'))
|
||||
return { 'exe': exe, 'args': args }
|
||||
endif
|
||||
endfor
|
||||
@ -58,7 +58,7 @@ endfunction " }}}2
|
||||
|
||||
" Parse a version string. Return an array of version components.
|
||||
function! syntastic#util#parseVersion(version) " {{{2
|
||||
return split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.')
|
||||
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
|
||||
endfunction " }}}2
|
||||
|
||||
" Run 'command' in a shell and parse output as a version string.
|
||||
@ -74,15 +74,21 @@ endfunction " }}}2
|
||||
"
|
||||
" See http://semver.org for info about version numbers.
|
||||
function! syntastic#util#versionIsAtLeast(installed, required) " {{{2
|
||||
for idx in range(max([len(a:installed), len(a:required)]))
|
||||
let installed_element = get(a:installed, idx, 0)
|
||||
let required_element = get(a:required, idx, 0)
|
||||
if installed_element != required_element
|
||||
return installed_element > required_element
|
||||
return syntastic#util#compareLexi(a:installed, a:required) >= 0
|
||||
endfunction " }}}2
|
||||
|
||||
" Almost lexicographic comparison of two lists of integers. :) If lists
|
||||
" have different lengths, the "missing" elements are assumed to be 0.
|
||||
function! syntastic#util#compareLexi(a, b) " {{{2
|
||||
for idx in range(max([len(a:a), len(a:b)]))
|
||||
let a_element = str2nr(get(a:a, idx, 0))
|
||||
let b_element = str2nr(get(a:b, idx, 0))
|
||||
if a_element != b_element
|
||||
return a_element > b_element ? 1 : -1
|
||||
endif
|
||||
endfor
|
||||
" Everything matched, so it is at least the required version.
|
||||
return 1
|
||||
return 0
|
||||
endfunction " }}}2
|
||||
|
||||
" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen()
|
||||
@ -226,6 +232,13 @@ function! syntastic#util#sortLoclist(errors) " {{{2
|
||||
call sort(a:errors, 's:compareErrorItems')
|
||||
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.
|
||||
function! syntastic#util#stamp() " {{{2
|
||||
return reltime(g:syntastic_start)
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" Private functions {{{1
|
||||
|
@ -36,12 +36,14 @@ CONTENTS *syntastic-contents*
|
||||
5.3.Configuring specific checkers..........|syntastic-config-makeprg|
|
||||
6.Notes........................................|syntastic-notes|
|
||||
6.1.Handling of composite filetypes........|syntastic-composite|
|
||||
6.2.Interaction with python-mode...........|syntastic-pymode|
|
||||
6.3.Interaction with the fish shell........|syntastic-fish|
|
||||
6.4.Interaction with PowerShell............|syntastic-powershell|
|
||||
6.5.Using syntastic with the fizsh shell...|syntastic-fizsh|
|
||||
6.6.Interaction with Eclim.................|syntastic-eclim|
|
||||
6.7.Interaction with vim-virtualenv........|syntastic-vim-virtualenv|
|
||||
6.2.Editing files over network.............|syntastic-netrw|
|
||||
6.3.Interaction with python-mode...........|syntastic-pymode|
|
||||
6.4.Interaction with YouCompleteMe.........|syntastic-ycm|
|
||||
6.5.Interaction with the fish shell........|syntastic-fish|
|
||||
6.6.Interaction with PowerShell............|syntastic-powershell|
|
||||
6.7.Using syntastic with the fizsh shell...|syntastic-fizsh|
|
||||
6.8.Interaction with Eclim.................|syntastic-eclim|
|
||||
6.9.Interaction with vim-virtualenv........|syntastic-vim-virtualenv|
|
||||
7.About........................................|syntastic-about|
|
||||
8.License......................................|syntastic-license|
|
||||
|
||||
@ -321,8 +323,8 @@ error symbols can be customized:
|
||||
syntastic_style_warning_symbol - For style warnings, defaults to 'S>'
|
||||
|
||||
Example: >
|
||||
let g:syntastic_error_symbol = '✗'
|
||||
let g:syntastic_warning_symbol = '⚠'
|
||||
let g:syntastic_error_symbol = "✗"
|
||||
let g:syntastic_warning_symbol = "⚠"
|
||||
<
|
||||
*'syntastic_enable_balloons'*
|
||||
Default: 1
|
||||
@ -394,12 +396,12 @@ Default: {}
|
||||
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',
|
||||
\ 'gentoo-metadata': 'xml' }
|
||||
let g:syntastic_filetype_map = { "latex": "tex",
|
||||
\ "gentoo-metadata": "xml" }
|
||||
<
|
||||
Composite filetypes can also be mapped to simple types, which disables the
|
||||
default behaviour of running both checkers against the input file: >
|
||||
let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' }
|
||||
let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
|
||||
<
|
||||
*'syntastic_mode_map'*
|
||||
Default: { "mode": "active",
|
||||
@ -411,26 +413,26 @@ done).
|
||||
|
||||
The option should be set to something like: >
|
||||
|
||||
let g:syntastic_mode_map = { 'mode': 'active',
|
||||
\ 'active_filetypes': ['ruby', 'php'],
|
||||
\ 'passive_filetypes': ['puppet'] }
|
||||
let g:syntastic_mode_map = { "mode": "active",
|
||||
\ "active_filetypes": ["ruby", "php"],
|
||||
\ "passive_filetypes": ["puppet"] }
|
||||
<
|
||||
"mode" can be mapped to one of two values - "active" or "passive". When set to
|
||||
active, syntastic does automatic checking whenever a buffer is saved or
|
||||
"mode" can be mapped to one of two values - "active" or "passive". When set
|
||||
to "active", syntastic does automatic checking whenever a buffer is saved or
|
||||
initially opened. When set to "passive" syntastic only checks when the user
|
||||
calls |:SyntasticCheck|.
|
||||
|
||||
The exceptions to these rules are defined with "active_filetypes" and
|
||||
"passive_filetypes". In passive mode, automatic checks are still done
|
||||
for all filetypes in the "active_filetypes" array. In active mode,
|
||||
automatic checks are not done for any filetypes in the
|
||||
"passive_filetypes" array.
|
||||
"passive_filetypes". In passive mode, automatic checks are still done for
|
||||
filetypes in the "active_filetypes" array (and "passive_filetypes" is
|
||||
ignored). In active mode, automatic checks are not done for any filetypes in
|
||||
the "passive_filetypes" array ("active_filetypes" is ignored).
|
||||
|
||||
If any of "mode", "active_filetypes", or "passive_filetypes" are left
|
||||
unspecified, they default to values above.
|
||||
|
||||
At runtime, the |:SyntasticToggleMode| command can be used to switch between
|
||||
active and passive mode.
|
||||
|
||||
If any of "mode", "active_filetypes", or "passive_filetypes" are not specified
|
||||
then they will default to their default value as above.
|
||||
active and passive modes.
|
||||
|
||||
*'syntastic_quiet_messages'*
|
||||
Default: {}
|
||||
@ -471,7 +473,7 @@ Since filter elements with values [] or '' are ignored, you can disable global
|
||||
filters for particular checkers, by setting the values of the corresponding
|
||||
elements in |'syntastic_<filetype>_<checker>_quiet_messages'| to [] or ''. For
|
||||
example, the following setting will silence all warnings, except for the
|
||||
ones produced by 'pylint': >
|
||||
ones produced by "pylint": >
|
||||
let g:syntastic_quiet_messages = { "level": "warnings" }
|
||||
let g:syntastic_python_pylint_quiet_messages = { "level" : [] }
|
||||
<
|
||||
@ -540,7 +542,7 @@ List of filetypes handled by checkers external to syntastic. If you have a Vim
|
||||
plugin that adds a checker for syntastic, and if the said checker deals with a
|
||||
filetype that is unknown to syntastic, you might consider adding that filetype
|
||||
to this list: >
|
||||
let g:syntastic_extra_filetypes = [ 'make', 'gitcommit' ]
|
||||
let g:syntastic_extra_filetypes = [ "make", "gitcommit" ]
|
||||
<
|
||||
This will allow |:SyntasticInfo| to do proper tab completion for the new
|
||||
filetypes.
|
||||
@ -554,14 +556,14 @@ filetypes.
|
||||
*'g:syntastic_<filetype>_checkers'*
|
||||
You can tell syntastic which checkers to run for a given filetype by setting a
|
||||
variable 'g:syntastic_<filetype>_checkers' to a list of checkers, e.g. >
|
||||
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
|
||||
let g:syntastic_php_checkers = ["php", "phpcs", "phpmd"]
|
||||
<
|
||||
*'b:syntastic_checkers'*
|
||||
There is also a per-buffer version of this setting, 'b:syntastic_checkers'.
|
||||
When set, it takes precedence over |'g:syntastic_<filetype>_checkers'|. You can
|
||||
use this in an autocmd to configure specific checkers for particular paths: >
|
||||
autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 |
|
||||
\ let b:syntastic_checkers = ['pylint'] | endif
|
||||
autocmd FileType python if stridx(expand("%:p"), "/some/path/") == 0 |
|
||||
\ let b:syntastic_checkers = ["pylint"] | endif
|
||||
<
|
||||
If neither |'g:syntastic_<filetype>_checkers'| nor |'b:syntastic_checkers'|
|
||||
is set, a default list of checker is used. Beware however that this list
|
||||
@ -592,21 +594,27 @@ default - in fact you can customise every part of the command that gets called.
|
||||
*'syntastic_<filetype>_<checker>_<option>'*
|
||||
Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: >
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': self.getExec(),
|
||||
\ 'args': '-a -b -c',
|
||||
\ 'post_args': '--more --args',
|
||||
\ 'tail': '> /tmp/output' })
|
||||
\ "exe": self.getExec(),
|
||||
\ "args": "-a -b -c",
|
||||
\ "post_args": "--more --args",
|
||||
\ "tail": "2>/dev/null" })
|
||||
<
|
||||
The result is a 'makeprg' of the form: >
|
||||
<exe> <args> <fname> <post_args> <tail>
|
||||
<
|
||||
*'syntastic_<filetype>_<checker>_exe'*
|
||||
All arguments above are optional, and can be overridden by setting global
|
||||
variables 'g:syntastic_<filetype>_<checker-name>_<option-name>' - even
|
||||
parameters not specified in the call to makeprgBuild(). These variables also
|
||||
have local versions 'b:syntastic_<filetype>_<checker-name>_<option-name>',
|
||||
which take precedence over the global ones in the corresponding buffers.
|
||||
|
||||
If one of these variables has a non-empty default and you want it to be empty,
|
||||
you can set it to a space, e.g.: >
|
||||
let g:syntastic_javascript_jslint_args = " "
|
||||
<
|
||||
(setting it to an empty string doesn't work, for implementation reasons).
|
||||
|
||||
*'syntastic_<filetype>_<checker>_exe'*
|
||||
The 'exe' is normally the same as the 'exec' attribute described above, in
|
||||
which case it may be omitted. However, you can use it to add environment
|
||||
variables or additional parameters, e.g. to tell the mri checker to use KANJI
|
||||
@ -641,37 +649,56 @@ See |syntastic_quiet_messages| for the syntax.
|
||||
------------------------------------------------------------------------------
|
||||
6.1. Handling of composite filetypes *syntastic-composite*
|
||||
|
||||
Some Vim plugins use composite filetypes, such as 'django.python' or
|
||||
'handlebars.html'. Normally, syntastic deals with this situation by splitting
|
||||
Some Vim plugins use composite filetypes, such as "django.python" or
|
||||
"handlebars.html". Normally, syntastic deals with this situation by splitting
|
||||
the filetype in its simple components, and calling all checkers that apply.
|
||||
If this behaviour is not desirable, you can disable it by mapping the
|
||||
composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: >
|
||||
let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' }
|
||||
let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.2 Interaction with python-mode *syntastic-pymode*
|
||||
6.2 Editing files over network *syntastic-netrw*
|
||||
|
||||
The standard plugin |netrw| allows Vim to transparently edit files over
|
||||
network and inside archives. Currently syntastic doesn't support this mode
|
||||
of operation. It can only check files that can be accessed directly by local
|
||||
checkers, without any translation or conversion.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.3 Interaction with 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
|
||||
default when you save buffers to disk, and this is probably not what you want.
|
||||
To avoid both plugins opening error windows, you can either set passive mode
|
||||
for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
|
||||
python-mode, by setting |pymode_lint_write| to 0. E.g.: >
|
||||
'python-mode', by setting |pymode_lint_write| to 0. E.g.: >
|
||||
let g:pymode_lint_write = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.3 Interaction with the fish shell *syntastic-fish*
|
||||
6.4 Interaction with YouCompleteMe *syntastic-ycm*
|
||||
|
||||
Syntastic can be used together with the 'YouCompleteMe' Vim plugin (see
|
||||
http://valloric.github.io/YouCompleteMe/). However, by default 'YouCompleteMe'
|
||||
disables syntastic"s checkers for the "c", "cpp", "objc", and "objcpp"
|
||||
filetypes, in order to allow its own checkers to run. If you want to use YCM's
|
||||
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
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.5 Interaction with the fish shell *syntastic-fish*
|
||||
|
||||
At the time of this writing the 'fish' shell (see http://fishshell.com/)
|
||||
doesn't support the standard UNIX syntax for file redirections, and thus it
|
||||
can't be used together with syntastic. You don't need to change your login
|
||||
shell to address this problem, but you do have to point Vim's 'shell' to a more
|
||||
traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne
|
||||
'sh': >
|
||||
traditional shell, such as "zsh", "bash", "ksh", or even the original Bourne
|
||||
"sh": >
|
||||
set shell=bash
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.4. Interaction with PowerShell *syntastic-powershell*
|
||||
6.6. Interaction with PowerShell *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
|
||||
@ -680,7 +707,7 @@ Vim's 'shell' to a more traditional program, such as 'cmd.exe': >
|
||||
set shell=cmd.exe
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.5. Using syntastic with the fizsh shell *syntastic-fizsh*
|
||||
6.7. Using syntastic with the fizsh shell *syntastic-fizsh*
|
||||
|
||||
Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh)
|
||||
is possible, but potentially problematic. In order to do it you'll need to set
|
||||
@ -688,12 +715,12 @@ is possible, but potentially problematic. In order to do it you'll need to set
|
||||
set shellredir=>%s\ 2>&1
|
||||
<
|
||||
Please keep in mind however that Vim can't take advantage of any of the
|
||||
interactive features of 'fizsh'. Using a more traditional shell such as 'zsh',
|
||||
'bash', 'ksh', or the original Bourne 'sh' might be a better choice: >
|
||||
interactive features of 'fizsh'. Using a more traditional shell such as "zsh",
|
||||
"bash", "ksh", or the original Bourne "sh" might be a better choice: >
|
||||
set shell=zsh
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.6. Interaction with Eclim *syntastic-eclim*
|
||||
6.8. Interaction with Eclim *syntastic-eclim*
|
||||
|
||||
As far as syntastic is concerned there shouldn't be any compatibility problems
|
||||
with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of
|
||||
@ -702,7 +729,7 @@ makes syntastic forget some of its configuration parameters. No solutions or
|
||||
workarounds are known for now.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.7. Interaction with vim-virtualenv *syntastic-vim-virtualenv*
|
||||
6.9. Interaction with 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
|
||||
|
@ -19,12 +19,12 @@ if has('reltime')
|
||||
lockvar! g:syntastic_start
|
||||
endif
|
||||
|
||||
let g:syntastic_version = '3.4.0-90'
|
||||
let g:syntastic_version = '3.4.0-117'
|
||||
lockvar g:syntastic_version
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
||||
for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands']
|
||||
for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'reltime', 'user_commands']
|
||||
if !has(s:feature)
|
||||
call syntastic#log#error("need Vim compiled with feature " . s:feature)
|
||||
finish
|
||||
@ -65,10 +65,11 @@ let g:syntastic_defaults = {
|
||||
\ 'filetype_map': {},
|
||||
\ 'full_redraws': !(has('gui_running') || has('gui_macvim')),
|
||||
\ 'id_checkers': 1,
|
||||
\ 'ignore_extensions': '\c\v^([gx]?z|lzma|bz2)$',
|
||||
\ 'ignore_files': [],
|
||||
\ 'loc_list_height': 10,
|
||||
\ 'quiet_messages': {},
|
||||
\ 'reuse_loc_lists': (v:version >= 704),
|
||||
\ 'reuse_loc_lists': 0,
|
||||
\ 'sort_aggregated_errors': 1,
|
||||
\ 'stl_format': '[Syntax: line:%F (%t)]',
|
||||
\ 'style_error_symbol': 'S>',
|
||||
@ -167,7 +168,7 @@ command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck
|
||||
\ call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
command! Errors call s:ShowLocList()
|
||||
command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo
|
||||
\ call s:modemap.echoMode() |
|
||||
\ call s:modemap.modeInfo(<f-args>) |
|
||||
\ call s:registry.echoInfoFor(s:resolveFiletypes(<f-args>))
|
||||
command! SyntasticReset
|
||||
\ call s:ClearCache() |
|
||||
@ -237,6 +238,11 @@ endfunction " }}}2
|
||||
|
||||
"refresh and redraw all the error info for this buf when saving or reading
|
||||
function! s:UpdateErrors(auto_invoked, ...) " {{{2
|
||||
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'version')
|
||||
call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options)
|
||||
call syntastic#log#debugDump(g:SyntasticDebugVariables)
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
|
||||
\ ': ' . (a:0 ? join(a:000) : 'default checkers'))
|
||||
if s:skipFile()
|
||||
return
|
||||
endif
|
||||
@ -288,14 +294,13 @@ endfunction " }}}2
|
||||
|
||||
"detect and cache all syntax errors in this buffer
|
||||
function! s:CacheErrors(checker_names) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: ' .
|
||||
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
|
||||
call s:ClearCache()
|
||||
let newLoclist = g:SyntasticLoclist.New([])
|
||||
|
||||
if !s:skipFile()
|
||||
" debug logging {{{3
|
||||
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'version')
|
||||
call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options)
|
||||
call syntastic#log#debugDump(g:SyntasticDebugVariables)
|
||||
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'aggregate_errors')
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'getcwd() = ' . getcwd())
|
||||
" }}}3
|
||||
@ -376,7 +381,6 @@ function! s:CacheErrors(checker_names) " {{{2
|
||||
endif
|
||||
endif
|
||||
|
||||
call newLoclist.setOwner(bufnr(''))
|
||||
call newLoclist.deploy()
|
||||
endfunction " }}}2
|
||||
|
||||
@ -408,7 +412,9 @@ endfunction " }}}2
|
||||
" 'preprocess' - a function to be applied to the error file before parsing errors
|
||||
" 'postprocess' - a list of functions to be applied to the error list
|
||||
" 'cwd' - change directory to the given path before running the checker
|
||||
" 'env' - environment variables to set before running the checker
|
||||
" 'returns' - a list of valid exit codes for the checker
|
||||
" @vimlint(EVL102, 1, l:env_save)
|
||||
function! SyntasticMake(options) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'SyntasticMake: called with options:', a:options)
|
||||
|
||||
@ -432,11 +438,31 @@ function! SyntasticMake(options) " {{{2
|
||||
execute 'lcd ' . fnameescape(a:options['cwd'])
|
||||
endif
|
||||
|
||||
" set environment variables {{{3
|
||||
let env_save = {}
|
||||
if has_key(a:options, 'env') && len(a:options['env'])
|
||||
for key in keys(a:options['env'])
|
||||
if key =~? '\m^[a-z_]\+$'
|
||||
exec 'let env_save[' . string(key) . '] = $' . key
|
||||
exec 'let $' . key . ' = ' . string(a:options['env'][key])
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
let $LC_MESSAGES = 'C'
|
||||
let $LC_ALL = ''
|
||||
" }}}3
|
||||
|
||||
let err_lines = split(system(a:options['makeprg']), "\n", 1)
|
||||
|
||||
" restore environment variables {{{3
|
||||
let $LC_ALL = old_lc_all
|
||||
let $LC_MESSAGES = old_lc_messages
|
||||
if len(env_save)
|
||||
for key in keys(env_save)
|
||||
exec 'let $' . key . ' = ' . string(env_save[key])
|
||||
endfor
|
||||
endif
|
||||
" }}}3
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'checker output:', err_lines)
|
||||
|
||||
@ -497,6 +523,7 @@ function! SyntasticMake(options) " {{{2
|
||||
|
||||
return errors
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL102, 0, l:env_save)
|
||||
|
||||
"return a string representing the state of buffer according to
|
||||
"g:syntastic_stl_format
|
||||
@ -527,9 +554,14 @@ endfunction " }}}2
|
||||
|
||||
" Skip running in special buffers
|
||||
function! s:skipFile() " {{{2
|
||||
let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0
|
||||
let fname = expand('%')
|
||||
return force_skip || (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') || s:ignoreFile(fname)
|
||||
let skip = (exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0) ||
|
||||
\ (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') ||
|
||||
\ s:ignoreFile(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'skipFile: skipping')
|
||||
endif
|
||||
return skip
|
||||
endfunction " }}}2
|
||||
|
||||
" Take a list of errors and add default values to them from a:options
|
||||
|
@ -43,6 +43,7 @@ endfunction " }}}2
|
||||
" Reset the error balloons
|
||||
" @vimlint(EVL103, 1, a:loclist)
|
||||
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
|
||||
let b:syntastic_balloons = {}
|
||||
if has('balloon_eval')
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset')
|
||||
set nobeval
|
||||
|
@ -32,8 +32,8 @@ endfunction " }}}2
|
||||
" Sets error highlights in the cuirrent window
|
||||
function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
|
||||
if self.enabled()
|
||||
call self.reset(a:loclist)
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh')
|
||||
call self._reset()
|
||||
let buf = bufnr('')
|
||||
let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf')
|
||||
for item in issues
|
||||
@ -64,11 +64,7 @@ endfunction " }}}2
|
||||
function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2
|
||||
if s:has_highlighting
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: reset')
|
||||
for match in getmatches()
|
||||
if stridx(match['group'], 'Syntastic') == 0
|
||||
call matchdelete(match['id'])
|
||||
endif
|
||||
endfor
|
||||
call self._reset()
|
||||
endif
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:loclist)
|
||||
@ -95,6 +91,14 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticHighlightingNotifier._reset() " {{{2
|
||||
for match in getmatches()
|
||||
if stridx(match['group'], 'Syntastic') == 0
|
||||
call matchdelete(match['id'])
|
||||
endif
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
@ -46,6 +46,14 @@ function! g:SyntasticLoclist.isEmpty() " {{{2
|
||||
return empty(self._rawLoclist)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2
|
||||
if !exists("self._stamp")
|
||||
let self._stamp = []
|
||||
return 0
|
||||
endif
|
||||
return syntastic#util#compareLexi(self._stamp, a:stamp) > 0
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.copyRaw() " {{{2
|
||||
return copy(self._rawLoclist)
|
||||
endfunction " }}}2
|
||||
@ -132,6 +140,8 @@ function! g:SyntasticLoclist.setOwner(buffer) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.deploy() " {{{2
|
||||
call self.setOwner(bufnr(''))
|
||||
let self._stamp = syntastic#util#stamp()
|
||||
for buf in self.getBuffers()
|
||||
call setbufvar(buf, 'syntastic_loclist', self)
|
||||
endfor
|
||||
|
@ -19,8 +19,8 @@ endfunction " }}}2
|
||||
function! g:SyntasticModeMap.synch() " {{{2
|
||||
if exists('g:syntastic_mode_map')
|
||||
let self._mode = get(g:syntastic_mode_map, 'mode', 'active')
|
||||
let self._activeFiletypes = get(g:syntastic_mode_map, 'active_filetypes', [])
|
||||
let self._passiveFiletypes = get(g:syntastic_mode_map, 'passive_filetypes', [])
|
||||
let self._activeFiletypes = copy(get(g:syntastic_mode_map, 'active_filetypes', []))
|
||||
let self._passiveFiletypes = copy(get(g:syntastic_mode_map, 'passive_filetypes', []))
|
||||
else
|
||||
let self._mode = 'active'
|
||||
let self._activeFiletypes = []
|
||||
@ -62,6 +62,27 @@ function! g:SyntasticModeMap.echoMode() " {{{2
|
||||
echo "Syntastic: " . self._mode . " mode enabled"
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.modeInfo(...) " {{{2
|
||||
echomsg 'Syntastic version: ' . g:syntastic_version
|
||||
let type = a:0 ? a:1 : &filetype
|
||||
echomsg 'Info for filetype: ' . type
|
||||
|
||||
call self.synch()
|
||||
echomsg 'Mode: ' . self._mode
|
||||
if self._mode ==# 'active'
|
||||
if len(self._passiveFiletypes)
|
||||
let plural = len(self._passiveFiletypes) != 1 ? 's' : ''
|
||||
echomsg 'Passive filetype' . plural . ': ' . join(sort(copy(self._passiveFiletypes)))
|
||||
endif
|
||||
else
|
||||
if len(self._activeFiletypes)
|
||||
let plural = len(self._activeFiletypes) != 1 ? 's' : ''
|
||||
echomsg 'Active filetype' . plural . ': ' . join(sort(copy(self._activeFiletypes)))
|
||||
endif
|
||||
endif
|
||||
echomsg 'Filetype ' . type . ' is ' . (self.allowsAutoChecking(type) ? 'active' : 'passive')
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" Private methods {{{1
|
||||
|
@ -8,6 +8,9 @@ let g:SyntasticNotifiers = {}
|
||||
let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
|
||||
lockvar! s:notifier_types
|
||||
|
||||
let s:persistent_notifiers = ['signs', 'balloons']
|
||||
lockvar! s:persistent_notifiers
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticNotifiers.Instance() " {{{2
|
||||
@ -20,11 +23,27 @@ function! g:SyntasticNotifiers.Instance() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticNotifiers.refresh(loclist) " {{{2
|
||||
if !a:loclist.isEmpty() && !a:loclist.isNewerThan([])
|
||||
" loclist not fully constructed yet
|
||||
return
|
||||
endif
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: refresh')
|
||||
for type in self._enabled_types
|
||||
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
|
||||
if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled()
|
||||
call self._notifier[type].refresh(a:loclist)
|
||||
if index(s:persistent_notifiers, type) > -1
|
||||
" refresh only if loclist has changed since last call
|
||||
if !exists('b:syntastic_' . type . '_stamp')
|
||||
let b:syntastic_{type}_stamp = []
|
||||
endif
|
||||
if a:loclist.isNewerThan(b:syntastic_{type}_stamp) || a:loclist.isEmpty()
|
||||
call self._notifier[type].refresh(a:loclist)
|
||||
let b:syntastic_{type}_stamp = syntastic#util#stamp()
|
||||
endif
|
||||
else
|
||||
call self._notifier[type].refresh(a:loclist)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
@ -40,6 +59,11 @@ function! g:SyntasticNotifiers.reset(loclist) " {{{2
|
||||
if has_key(g:{class}, 'reset')
|
||||
call self._notifier[type].reset(a:loclist)
|
||||
endif
|
||||
|
||||
" also reset stamps
|
||||
if index(s:persistent_notifiers, type) > -1
|
||||
let b:syntastic_{type}_stamp = []
|
||||
endif
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -9,6 +9,7 @@ let s:defaultCheckers = {
|
||||
\ 'actionscript':['mxmlc'],
|
||||
\ 'ada': ['gcc'],
|
||||
\ 'applescript': ['osacompile'],
|
||||
\ 'arduino': ['avrgcc'],
|
||||
\ 'asciidoc': ['asciidoc'],
|
||||
\ 'asm': ['gcc'],
|
||||
\ 'bro': ['bro'],
|
||||
@ -29,7 +30,7 @@ let s:defaultCheckers = {
|
||||
\ 'dart': ['dartanalyzer'],
|
||||
\ 'docbk': ['xmllint'],
|
||||
\ 'dustjs': ['swiffer'],
|
||||
\ 'elixir': ['elixir'],
|
||||
\ 'elixir': [],
|
||||
\ 'erlang': ['escript'],
|
||||
\ 'eruby': ['ruby'],
|
||||
\ 'fortran': ['gfortran'],
|
||||
@ -178,9 +179,6 @@ function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
|
||||
echomsg "Syntastic version: " . g:syntastic_version
|
||||
echomsg "Info for filetype: " . join(a:ftalias_list, '.')
|
||||
|
||||
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' ))
|
||||
if len(ft_list) != 1
|
||||
let available = []
|
||||
@ -196,8 +194,15 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
|
||||
let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()')
|
||||
endif
|
||||
|
||||
echomsg "Available checker(s): " . join(sort(available))
|
||||
echomsg "Currently enabled checker(s): " . join(active)
|
||||
let cnt = len(available)
|
||||
let plural = cnt != 1 ? 's' : ''
|
||||
let cklist = cnt ? join(sort(available)) : '-'
|
||||
echomsg 'Available checker' . plural . ': ' . cklist
|
||||
|
||||
let cnt = len(active)
|
||||
let plural = cnt != 1 ? 's' : ''
|
||||
let cklist = cnt ? join(active) : '-'
|
||||
echomsg 'Currently enabled checker' . plural . ': ' . cklist
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
@ -42,7 +42,6 @@ function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
|
||||
call self._signErrors(a:loclist)
|
||||
endif
|
||||
call self._removeSigns(old_signs)
|
||||
let s:first_sign_id = exists('s:next_sign_id') ? s:next_sign_id : 5000
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
@ -88,26 +87,29 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
|
||||
let loclist = a:loclist
|
||||
if !loclist.isEmpty()
|
||||
|
||||
" errors some first, so that they are not masked by warnings
|
||||
let buf = bufnr('')
|
||||
if !bufloaded(buf)
|
||||
" signs can be placed only in loaded buffers
|
||||
return
|
||||
endif
|
||||
|
||||
" errors come first, so that they are not masked by warnings
|
||||
let issues = copy(loclist.errors())
|
||||
call extend(issues, loclist.warnings())
|
||||
call filter(issues, 'v:val["bufnr"] == buf')
|
||||
let seen = {}
|
||||
|
||||
for i in issues
|
||||
if !has_key(seen, i['lnum'])
|
||||
if i['lnum'] > 0 && !has_key(seen, i['lnum'])
|
||||
let seen[i['lnum']] = 1
|
||||
|
||||
if i['lnum'] > 0
|
||||
let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
|
||||
let sign_subtype = get(i, 'subtype', '')
|
||||
let sign_type = 'Syntastic' . sign_subtype . sign_severity
|
||||
let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
|
||||
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']
|
||||
call add(self._bufSignIds(), s:next_sign_id)
|
||||
let s:next_sign_id += 1
|
||||
endif
|
||||
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
|
||||
endfor
|
||||
endif
|
||||
|
@ -0,0 +1,26 @@
|
||||
"============================================================================
|
||||
"File: avrgcc.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Karel <karelishere at gmail dot 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_arduino_avrgcc_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_arduino_avrgcc_checker = 1
|
||||
|
||||
runtime! syntax_checkers/c/*.vim
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'name': 'avrgcc',
|
||||
\ 'exec': 'avr-gcc',
|
||||
\ 'redirect': 'c/avrgcc'})
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -53,3 +53,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
|
@ -24,6 +24,11 @@ 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'
|
||||
|
@ -30,7 +30,7 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict
|
||||
endif
|
||||
|
||||
let shebang = syntastic#util#parseShebang()
|
||||
if shebang['exe'] =~# '\m\<escript$' || (shebang['exe'] ==# '/usr/bin/env' && shebang['args'][0] ==# 'escript')
|
||||
if shebang['exe'] ==# 'escript'
|
||||
let args = '-s'
|
||||
let post_args = ''
|
||||
else
|
||||
|
@ -38,3 +38,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
||||
|
@ -22,24 +22,14 @@ function! SyntaxCheckers_eruby_ruby_IsAvailable() dict
|
||||
if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec')
|
||||
let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec
|
||||
endif
|
||||
let s:exe = self.getExec()
|
||||
|
||||
if executable(s:exe)
|
||||
let s:exe = syntastic#util#shescape(s:exe)
|
||||
if !syntastic#util#isRunningWindows()
|
||||
let s:exe = 'RUBYOPT= ' . s:exe
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
return executable(self.getExec())
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
||||
let fname = "'" . escape(expand('%'), "\\'") . "'"
|
||||
|
||||
" TODO: encodings became useful in ruby 1.9 :)
|
||||
if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(s:exe . ' --version'), [1, 9])
|
||||
if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped(). ' --version'), [1, 9])
|
||||
let enc = &fileencoding != '' ? &fileencoding : &encoding
|
||||
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
|
||||
else
|
||||
@ -48,11 +38,11 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
||||
|
||||
"gsub fixes issue #7, rails has it's own eruby syntax
|
||||
let makeprg =
|
||||
\ s:exe . ' -rerb -e ' .
|
||||
\ self.getExecEscaped() . ' -rerb -e ' .
|
||||
\ syntastic#util#shescape('puts ERB.new(File.read(' .
|
||||
\ fname . encoding_spec .
|
||||
\ ').gsub(''<%='',''<%''), nil, ''-'').src') .
|
||||
\ ' | ' . s:exe . ' -c'
|
||||
\ ' | ' . self.getExecEscaped() . ' -c'
|
||||
|
||||
let errorformat =
|
||||
\ '%-GSyntax OK,'.
|
||||
@ -61,9 +51,12 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
||||
\ '%Z%p^,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'RUBYOPT': '' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } })
|
||||
endfunction
|
||||
|
||||
|
@ -31,6 +31,8 @@ function! SyntaxCheckers_html_jshint_GetLocList() dict
|
||||
|
||||
let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)'
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
|
@ -186,9 +186,7 @@ function! s:Args()
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_html_tidy_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': s:Args(),
|
||||
\ 'tail': '2>&1' })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': s:Args() })
|
||||
|
||||
let errorformat =
|
||||
\ '%Wline %l column %v - Warning: %m,' .
|
||||
|
@ -399,8 +399,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': javac_opts,
|
||||
\ 'fname': syntastic#util#shescape(fname),
|
||||
\ 'tail': '2>&1' })
|
||||
\ 'fname': syntastic#util#shescape(fname) })
|
||||
|
||||
" unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types
|
||||
let errorformat =
|
||||
|
@ -40,6 +40,8 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() dict
|
||||
\ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' :
|
||||
\ '%E%f: line %l\, col %v\, %m'
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
|
@ -19,8 +19,7 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(item)
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_flake8_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l: could not compile,%-Z%p^,' .
|
||||
@ -28,9 +27,12 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
||||
\ '%A%f:%l: %t%n %m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
|
||||
for e in loclist
|
||||
" E*** and W*** are pep8 errors
|
||||
|
@ -19,9 +19,7 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
|
||||
\ 'args_after': '-vb' })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-vb' })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c:%m,' .
|
||||
@ -29,9 +27,12 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict
|
||||
\ '%-Z%p^,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
|
@ -19,8 +19,7 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict
|
||||
\ self.getExecEscaped() . ' --version'), [0, 3])
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
if s:pep257_new
|
||||
let errorformat =
|
||||
@ -33,9 +32,12 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict
|
||||
\ '%+C %m'
|
||||
endif
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'preprocess': 'killEmpty',
|
||||
\ 'postprocess': ['compressWhitespace'] })
|
||||
|
@ -21,14 +21,16 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_pep8_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'subtype': 'Style' })
|
||||
|
||||
for e in loclist
|
||||
|
@ -14,14 +14,16 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_py3kwarn_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%W%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -40,8 +40,7 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i)
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_pyflakes_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l: could not compile,'.
|
||||
@ -50,9 +49,12 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() dict
|
||||
\ '%E%f:%l: %m,'.
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'defaults': {'text': "Syntax error"} })
|
||||
|
||||
for e in loclist
|
||||
|
@ -23,18 +23,19 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(item)
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_pylama_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
|
||||
\ 'args_after': '-f pep8' })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-f pep8' })
|
||||
|
||||
" TODO: "WARNING:pylama:..." messages are probably a logging bug
|
||||
let errorformat =
|
||||
\ '%-GWARNING:pylama:%.%#,' .
|
||||
\ '%A%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
|
||||
" adjust for weirdness in each checker
|
||||
for e in loclist
|
||||
|
@ -23,7 +23,6 @@ endfunction
|
||||
|
||||
function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
|
||||
\ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') })
|
||||
|
||||
let errorformat =
|
||||
@ -33,9 +32,12 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
\ '%-Z%p^%.%#,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'returns': range(32) })
|
||||
|
||||
for e in loclist
|
||||
|
@ -26,15 +26,16 @@ function! SyntaxCheckers_python_python_IsAvailable() dict
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_python_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
|
||||
\ 'exe': [self.getExec(), s:compiler] })
|
||||
let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), s:compiler] })
|
||||
|
||||
let errorformat = '%E%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'returns': [0] })
|
||||
endfunction
|
||||
|
||||
|
@ -20,7 +20,6 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_ruby_jruby_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='),
|
||||
\ 'args': (syntastic#util#isRunningWindows() ? '-T1' : ''),
|
||||
\ 'args_after': '-W1 -c' })
|
||||
|
||||
@ -33,9 +32,12 @@ function! SyntaxCheckers_ruby_jruby_GetLocList() dict
|
||||
\ '%W%f:%l: %m,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'RUBYOPT': '' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -18,9 +18,7 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_ruby_macruby_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': 'RUBYOPT=',
|
||||
\ 'args_after': '-W1 -c' })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-W1 -c' })
|
||||
|
||||
let errorformat =
|
||||
\ '%-GSyntax OK,'.
|
||||
@ -31,9 +29,12 @@ function! SyntaxCheckers_ruby_macruby_GetLocList() dict
|
||||
\ '%W%f:%l: %m,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
let env = { 'RUBYOPT': '' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -35,9 +35,7 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_ruby_mri_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='),
|
||||
\ 'args_after': '-w -T1 -c' })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-w -T1 -c' })
|
||||
|
||||
"this is a hack to filter out a repeated useless warning in rspec files
|
||||
"containing lines like
|
||||
@ -62,9 +60,12 @@ function! SyntaxCheckers_ruby_mri_GetLocList() dict
|
||||
\ '%W%f:%l: %m,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'RUBYOPT': '' }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -53,7 +53,7 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict
|
||||
" value 3: the message is a warning
|
||||
"
|
||||
" References: :help vimlint-errorcode and :help vimlint-variables
|
||||
return vimlint#vimlint(expand('%'), {
|
||||
let param = {
|
||||
\ 'output': function('s:vimlintOutput'),
|
||||
\ 'quiet': 1,
|
||||
\ 'EVL102': 3,
|
||||
@ -63,7 +63,16 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict
|
||||
\ 'EVL106': 3,
|
||||
\ 'EVL201': 3,
|
||||
\ 'EVL204': 3,
|
||||
\ 'EVL205': 3 })
|
||||
\ 'EVL205': 3 }
|
||||
|
||||
if exists('g:syntastic_vimlint_options')
|
||||
if type(g:syntastic_vimlint_options) == type({})
|
||||
let options = filter(copy(g:syntastic_vimlint_options), 'v:key =~# "\\m^EVL"')
|
||||
call extend(param, options, 'force')
|
||||
endif
|
||||
endif
|
||||
|
||||
return vimlint#vimlint(expand('%'), param)
|
||||
endfunction
|
||||
|
||||
" @vimlint(EVL103, 1, a:filename)
|
||||
|
Reference in New Issue
Block a user