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

Updated plugins

This commit is contained in:
amix
2016-10-02 13:37:21 +02:00
parent 751af44cbe
commit aad95603ea
60 changed files with 1788 additions and 463 deletions

View File

@ -25,22 +25,21 @@
3. [Recommended settings](#settings)
4. [FAQ](#faq)
4.1. [I installed syntastic but it isn't reporting any errors...](#faqinfo)
4.2. [How can I check scripts written for different versions of Python?](#faqpython)
4.3. [How can I check scripts written for different versions of Ruby?](#faqruby)
4.4. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
4.5. [The `perl` checker has stopped working...](#faqperl)
4.6. [What happened to the `rustc` checker?](#faqrust)
4.7. [What happened to the `tsc` checker?](#faqtsc)
4.8. [What happened to the `xcrun` checker?](#faqxcrun)
4.9. [I run a checker and the location list is not updated...](#faqloclist)
4.9. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.10. [How can I pass additional arguments to a checker?](#faqargs)
4.11. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.12. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.13. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.14. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.15. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
4.16. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
4.2. [Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?](#faqcheckers)
4.3. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.4. [How can I pass additional arguments to a checker?](#faqargs)
4.5. [I run a checker and the location list is not updated...](#faqloclist)
4.5. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.6. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.7. [The error window is closed automatically when I `:quit` the current buffer but not when I `:bdelete` it?](#faqbdelete)
4.8. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
4.9. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.10. [How can I check scripts written for different versions of Python?](#faqpython)
4.11. [How can I check scripts written for different versions of Ruby?](#faqruby)
4.12. [The `perl` checker has stopped working...](#faqperl)
4.13. [What happened to the `rustc` checker?](#faqrust)
4.14. [What happened to the `tsc` checker?](#faqtsc)
4.15. [What happened to the `xcrun` checker?](#faqxcrun)
5. [Resources](#otherresources)
- - -
@ -106,9 +105,9 @@ version 7 or later with the "normal", "big", or "huge" feature sets should be
fine.
Syntastic should work with any modern plugin managers for Vim, such as
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], [Vim-Plug][plug], or
[Vundle][vundle]. Instructions for installing syntastic with [Pathogen][pathogen] are
included below for completeness.
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam],
[Vim-Plug][plug], or [Vundle][vundle]. Instructions for installing syntastic
with [Pathogen][pathogen] are included below for completeness.
Starting with Vim version 7.4.1486 you can also load syntastic using the
standard mechanism of packages, without the help of third-party plugin managers
@ -230,131 +229,12 @@ or the error output for a syntax checker may have changed. In this case, make
sure you have the latest version of the syntax checker installed. If it still
fails then post an [issue][bug_tracker] - or better yet, create a pull request.
<a name="faqpython"></a>
__4.2. Q. How can I check scripts written for different versions of Python?__
A. Install a Python version manager such as [virtualenv][virtualenv]
or [pyenv][pyenv], activate the environment for the relevant version
of Python, and install in it the checkers you want to use. Set
`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim]
from the virtual environment.
If you're starting Vim from a desktop manager rather than from a terminal you
might need to write wrapper scripts around your checkers, to activate the
virtual environment before running the actual checks. Then you'll need to
point the relevant `g:syntastic_python_<checker>_exec` variables to the wrapper
scripts.
<a name="faqruby"></a>
__4.3. Q. How can I check scripts written for different versions of Ruby?__
A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv],
activate the environment for the relevant version of Ruby, and install in it
the checkers you want to use. Set `g:syntastic_ruby_checkers` accordingly in
your `vimrc`, and run [Vim][vim] from the virtual environment.
If you're starting Vim from a desktop manager rather than from a terminal you
might need to write wrapper scripts around your checkers, to activate the
virtual environment before running the actual checks. Then you'll need to
point the relevant `g:syntastic_ruby_<checker>_exec` variables to the wrapper
scripts.
<a name="faqhtml5"></a>
__4.4. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
[HTML Tidy][tidy_old] has a fork named [HTML Tidy for HTML5][tidy]. It's a drop
in replacement, and syntastic can use it without changes. Just install it
somewhere and point `g:syntastic_html_tidy_exec` to its executable:
```vim
let g:syntastic_html_tidy_exec = 'tidy5'
```
Alternatively, you can install [vnu.jar][vnu_jar] from the [validator.nu][vnu]
project and run it as a [HTTP server][vnu_server]:
```sh
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
```
Then you can configure syntastic to use it:
```vim
let g:syntastic_html_validator_api = 'http://localhost:8888/'
```
<a name="faqperl"></a>
__4.5. Q. The `perl` checker has stopped working...__
A. The `perl` checker runs `perl -c` against your file, which in turn
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
statements in your file (cf. [perlrun][perlrun]). 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, 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
```
<a name="faqrust"></a>
__4.6. Q. What happened to the `rustc` checker?__
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
checker should be picked up automatically by syntastic.
<a name="faqtsc"></a>
__4.7. Q. What happened to the `tsc` checker?__
A. It didn't meet people's expectations and it has been removed. Please
consider using the external checker [tsuquyomi][tsuquyomi] instead. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="faqxcrun"></a>
__4.8. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="faqloclist"></a>
__4.9. Q. I run a checker and the location list is not updated...__
__4.9. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
A. By default the location list is changed only when you run the `:Errors`
command, in order to minimise conflicts with other plugins. If you want the
location list to always be updated when you run the checkers, add this line to
your `vimrc`:
```vim
let g:syntastic_always_populate_loc_list = 1
```
<a name="faqargs"></a>
__4.10. Q. How can I pass additional arguments to a checker?__
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
that do can be configured using global variables. The general form of the
global `args` variables is `syntastic_<filetype>_<checker>_args`.
So, If you wanted to pass `--my --args --here` to the ruby mri checker you
would add this line to your `vimrc`:
```vim
let g:syntastic_ruby_mri_args = "--my --args --here"
```
See `:help syntastic-checker-options` for more information.
<a name="faqcheckers"></a>
__4.11. Q. Syntastic supports several checkers for my filetype - how do I tell it
__4.2. Q. Syntastic supports several checkers for my filetype, how do I tell it
which one(s) to use?__
A. Stick a line like this in your `vimrc`:
A. Add a line like this to your `vimrc`:
```vim
let g:syntastic_<filetype>_checkers = ['<checker-name>']
```
@ -362,10 +242,9 @@ let g:syntastic_<filetype>_checkers = ['<checker-name>']
To see the list of supported checkers for your filetype read the
[manual][checkers] (`:help syntastic-checkers` in Vim).
e.g. Python has the following checkers, among others: `flake8`, `pyflakes`,
`pylint` and a native `python` checker.
To tell syntastic to use `pylint`, you would use this setting:
For example, Python has the following checkers, among others: `flake8`,
`pyflakes`, `pylint` and a native `python` checker. To tell syntastic to use
`pylint`, you would use this setting:
```vim
let g:syntastic_python_checkers = ['pylint']
```
@ -379,8 +258,7 @@ This is telling syntastic to run the `php` checker first, and if no errors are
found, run `phpcs`, and then `phpmd`.
You can also run checkers explicitly by calling `:SyntasticCheck <checker>`.
e.g. to run `phpcs` and `phpmd`:
For example to run `phpcs` and `phpmd`:
```vim
:SyntasticCheck phpcs phpmd
```
@ -390,39 +268,9 @@ aren't listed in `g:syntastic_<filetype>_checkers`. You can't run checkers for
"foreign" filetypes though (e.g. you can't run, say, a Python checker if the
filetype of the current file is `php`).
<a name="faqstyle"></a>
__4.12. Q. What is the difference between syntax checkers and style checkers?__
A. The errors and warnings they produce are highlighted differently and can
be filtered by different rules, but otherwise the distinction is pretty much
arbitrary. There is an ongoing effort to keep things consistent, so you can
_generally_ expect messages produced by syntax checkers to be _mostly_ related
to syntax, and messages produced by style checkers to be _mostly_ about style.
But there can be no formal guarantee that, say, a style checker that runs into
a syntax error wouldn't die with a fatal message, nor that a syntax checker
wouldn't give you warnings against using some constructs as being bad practice.
There is also no guarantee that messages marked as "style" are less severe than
the ones marked as "syntax" (whatever that might mean). And there are even a
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
nature, produce both kinds of messages. Syntastic is not smart enough to be
able to sort out these things by itself.
In fact it's more useful to look at this from the perspective of filtering
unwanted messages, rather than as an indicator of severity levels. The
distinction between syntax and style is orthogonal to the distinction between
errors and warnings, and thus you can turn off messages based on level, on
type, or both.
e.g. To disable all style messages:
```vim
let g:syntastic_quiet_messages = { "type": "style" }
```
See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a>
__4.13. Q. I have enabled multiple checkers for the current filetype. How can I
__4.3. Q. I have enabled multiple checkers for the current filetype. How can I
display all errors from all checkers together?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
@ -432,9 +280,46 @@ let g:syntastic_aggregate_errors = 1
See `:help syntastic-aggregating-errors` for more details.
<a name="faqargs"></a>
__4.4. Q. How can I pass additional arguments to a checker?__
A. In most cases a command line is constructed using an internal function
named `makeprgBuild()`, which provides a number of options that allow you to
customise every part of the command that gets run. You can set these options
using global variables.
The general form of the global `args` variable is
`syntastic_<filetype>_<checker>_args`. Thus if you wanted to pass
`--my --args --here` to the Ruby `mri` checker you would add this line to your
`vimrc`:
```vim
let g:syntastic_ruby_mri_args = "--my --args --here"
```
See `:help syntastic-checker-options` for more information.
A number of checkers don't use the `makeprgBuild()` function mentioned above,
or have additional options that can be configured. For these checkers the exact
list of options should be included in the [manual][checkers]
(`:help syntastic-checkers` in Vim).
<a name="faqloclist"></a>
__4.5. Q. I run a checker and the location list is not updated...__
__4.5. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
A. By default the location list is changed only when you run the `:Errors`
command, in order to minimise conflicts with other plugins. If you want the
location list to always be updated when you run the checkers, add this line to
your `vimrc`:
```vim
let g:syntastic_always_populate_loc_list = 1
```
<a name="faqlnext"></a>
__4.14. Q. How can I jump between the different errors without using the location
__4.6. Q. How can I jump between the different errors without using the location
list at the bottom of the window?__
A. Vim provides several built-in commands for this. See `:help :lnext` and
@ -444,9 +329,21 @@ If you use these commands a lot then you may want to add shortcut mappings to
your `vimrc`, or install something like [unimpaired][unimpaired], which provides such
mappings (among other things).
<a name="faqbdelete"></a>
__4.7. Q. The error window is closed automatically when I `:quit` the current buffer
but not when I `:bdelete` it?__
A. There is no safe way to handle that situation automatically, but you can
work around it:
```vim
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
```
<a name="faqconfig"></a>
__4.15. My favourite checker needs to load a configuration file from the
__4.8. My favourite checker needs to load a configuration file from the
project's root rather than the current directory...__
A. You can set up an `autocmd` to search for the configuration file in the
@ -463,18 +360,106 @@ autocmd FileType javascript let b:syntastic_javascript_jscs_args =
\ get(g:, 'syntastic_javascript_jscs_args', '') .
\ FindConfig('-c', '.jscsrc', expand('<afile>:p:h', 1))
```
<a name="faqbdelete"></a>
__4.16. Q. The error window is closed automatically when I :quit the current buffer
but not when I :bdelete it?__
<a name="faqstyle"></a>
A. There is no safe way to handle that situation automatically, but you can
work around it:
__4.9. Q. What is the difference between syntax checkers and style checkers?__
A. The errors and warnings they produce are highlighted differently and can
be filtered by different rules, but otherwise the distinction is pretty much
arbitrary. There is an ongoing effort to keep things consistent, so you can
_generally_ expect messages produced by syntax checkers to be _mostly_ related
to syntax, and messages produced by style checkers to be _mostly_ about style.
But there can be no formal guarantee that, say, a style checker that runs into
a syntax error wouldn't die with a fatal message, nor that a syntax checker
wouldn't give you warnings against using some constructs as being bad practice.
There is also no guarantee that messages marked as `style` are less severe than
the ones marked as `syntax` (whatever that might mean). And there are even a
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
nature, produce both kinds of messages. Syntastic is not smart enough to be
able to sort out these things by itself.
Generally it's more useful to look at this from the perspective of filtering
unwanted messages, rather than as an indicator of severity levels. The
distinction between syntax and style is orthogonal to the distinction between
errors and warnings, and thus you can turn off messages based on level, on
type, or both.
e.g. To disable all style messages:
```vim
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
let g:syntastic_quiet_messages = { "type": "style" }
```
See `:help syntastic_quiet_messages` for more information.
<a name="faqpython"></a>
__4.10. Q. How can I check scripts written for different versions of Python?__
A. Install a Python version manager such as [virtualenv][virtualenv]
or [pyenv][pyenv], activate the environment for the relevant version
of Python, and install in it the checkers you want to use. Set
`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim]
from the virtual environment.
If you're starting Vim from a desktop manager rather than from a terminal you
might need to write wrapper scripts around your checkers, to activate the
virtual environment before running the actual checks. Then you'll need to
point the relevant `g:syntastic_python_<checker>_exec` variables to the wrapper
scripts.
<a name="faqruby"></a>
__4.11. Q. How can I check scripts written for different versions of Ruby?__
A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv],
activate the environment for the relevant version of Ruby, and install in it
the checkers you want to use. Set `g:syntastic_ruby_checkers` accordingly in
your `vimrc`, and run [Vim][vim] from the virtual environment.
If you're starting Vim from a desktop manager rather than from a terminal you
might need to write wrapper scripts around your checkers, to activate the
virtual environment before running the actual checks. Then you'll need to
point the relevant `g:syntastic_ruby_<checker>_exec` variables to the wrapper
scripts.
<a name="faqperl"></a>
__4.12. Q. The `perl` checker has stopped working...__
A. The `perl` checker runs `perl -c` against your file, which in turn
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
statements in your file (cf. [perlrun][perlrun]). 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, 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
```
<a name="faqrust"></a>
__4.13. Q. What happened to the `rustc` checker?__
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
checker should be picked up automatically by syntastic.
<a name="faqtsc"></a>
__4.14. Q. What happened to the `tsc` checker?__
A. It didn't meet people's expectations and it has been removed. The plugin
[tsuquyomi][tsuquyomi] comes packaged with a checker for TypeScript. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="faqxcrun"></a>
__4.15. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="otherresources"></a>
@ -517,8 +502,6 @@ a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [v
[rvm]: https://rvm.io/
[stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic
[swift]: https://github.com/kballard/vim-swift
[tidy]: http://www.htacg.org/tidy-html5/
[tidy_old]: http://tidy.sourceforge.net/
[tsuquyomi]: https://github.com/Quramy/tsuquyomi/
[unimpaired]: https://github.com/tpope/vim-unimpaired
[vam]: https://github.com/MarcWeber/vim-addon-manager

View File

@ -271,6 +271,36 @@ function! syntastic#util#findGlobInParent(what, where) abort " {{{2
return ''
endfunction " }}}2
" Returns the buffer number of a filename
" @vimlint(EVL104, 1, l:old_shellslash)
function! syntastic#util#fname2buf(fname) abort " {{{2
if exists('+shellslash')
" bufnr() can't cope with backslashes
let old_shellslash = &shellslash
let &shellslash = 1
endif
" this is a best-effort attempt to escape file patterns (cf. :h file-pattern)
" XXX it fails for filenames containing something like \{2,3}
for md in [':~:.', ':~', ':p']
let buf = bufnr('^' . escape(fnamemodify(a:fname, md), '\*?,{}[') . '$')
if buf != -1
break
endif
endfor
if buf == -1
" XXX definitely wrong, but hope is the last thing to die :)
let buf = bufnr(fnamemodify(a:fname, ':p'))
endif
if exists('+shellslash')
let &shellslash = old_shellslash
endif
return buf
endfunction " }}}2
" @vimlint(EVL104, 0, l:old_shellslash)
" Returns unique elements in a list
function! syntastic#util#unique(list) abort " {{{2
let seen = {}
@ -342,10 +372,8 @@ function! syntastic#util#stamp() abort " {{{2
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
endfunction " }}}2
function! syntastic#util#setChangedtick() abort " {{{2
unlockvar! b:syntastic_changedtick
let b:syntastic_changedtick = b:changedtick
lockvar! b:syntastic_changedtick
function! syntastic#util#setLastTick(buf) abort " {{{2
call setbufvar(a:buf, 'syntastic_lasttick', getbufvar(a:buf, 'changedtick'))
endfunction " }}}2
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'

View File

@ -3147,13 +3147,13 @@ accepts the standard options described at |syntastic-config-makeprg|.
Notes~
Syntastic requires "Flow" version 0.6 or later.
Syntastic requires "Flow" version 0.18.1 or later.
To use "Flow" with your projects, you must:
a. Install it:
https://github.com/sindresorhus/flow-bin
https://github.com/flowtype/flow-bin
b. Configure your project:
>
@ -6183,7 +6183,7 @@ Maintainer: LCD 47 <lcd047@gmail.com>
"ESLint" is a tool for identifying and reporting on patterns found
in ECMAScript/JavaScript code. With the "babel-eslint" plugin
(https://github.com/babel/babel-eslint) "ESLint" can also can also be
(https://github.com/babel/babel-eslint) "ESLint" can also be
used to check TypeScript files. See the project's page for details:
https://github.com/nzakas/eslint

View File

@ -46,19 +46,21 @@ CONTENTS *syntastic-contents*
6.4.Saving Vim sessions....................|syntastic-sessions|
6.5.The location list callback.............|syntastic-loclist-callback|
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.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 MacVim..............|syntastic-zsh|
7.1.airline................................|syntastic-airline|
7.2.The csh and tcsh shells................|syntastic-csh|
7.3.Eclim..................................|syntastic-eclim|
7.4.ferret.................................|syntastic-ferret|
7.5.The fish shell.........................|syntastic-fish|
7.6.The fizsh shell........................|syntastic-fizsh|
7.7.flagship...............................|syntastic-flagship|
7.8.powerline..............................|syntastic-powerline|
7.9.The PowerShell shell...................|syntastic-powershell|
7.10.python-mode...........................|syntastic-pymode|
7.11.vim-auto-save.........................|syntastic-vim-auto-save|
7.12.vim-go................................|syntastic-vim-go|
7.13.vim-virtualenv........................|syntastic-vim-virtualenv|
7.14.YouCompleteMe.........................|syntastic-ycm|
7.15.The zsh shell and MacVim..............|syntastic-zsh|
8.About........................................|syntastic-about|
9.License......................................|syntastic-license|
@ -158,12 +160,17 @@ Something like this could be more useful: >
set statusline+=%*
<
When syntax errors are detected a flag will be shown. The content of the flag
is derived from the |syntastic_stl_format| option.
is derived from the |'syntastic_stl_format'| option.
Please note that these settings might conflict with other Vim plugins that
change the way statusline works. Refer to these plugins' documentation for
possible solutions. See also |syntastic-powerline| below if you're using the
"powerline" Vim plugin (https://github.com/powerline/powerline).
change the way statusline works. Refer to the |syntastic-compatibility| notes
below and to the respective plugins' documentation for possible solutions.
In particular see |syntastic-airline| below if you're using the "airline" Vim
plugin (https://github.com/vim-airline/vim-airline). See |syntastic-flagship|
if you're using "flagship" (https://github.com/tpope/vim-flagship). See also
|syntastic-powerline| if you're using the "powerline" Vim plugin
(https://github.com/powerline/powerline).
------------------------------------------------------------------------------
2.2. Error signs *syntastic-error-signs*
@ -195,6 +202,10 @@ following highlight groups:
Example: >
highlight SyntasticErrorLine guibg=#2f0000
<
With Vim 8.0 or later you can ask Vim not to turn off the sign column when no
errors are found, by setting 'signcolumn' to "yes": >
set signcolumn=yes
<
------------------------------------------------------------------------------
2.3. The error window *syntastic-error-window*
@ -248,7 +259,7 @@ grouped together, and sorting within each group is decided by the variables
|'syntastic_<filetype>_<checker>_sort'|.
------------------------------------------------------------------------------
2.6 Filtering errors *syntastic-filtering-errors*
2.6. Filtering errors *syntastic-filtering-errors*
You can selectively disable some of the errors found by checkers either
using |'syntastic_quiet_messages'|, or by specifying a list of patterns in
@ -732,7 +743,7 @@ filetypes.
5. Checker Options *syntastic-checker-options*
------------------------------------------------------------------------------
5.1 Choosing which checkers to use *syntastic-filetype-checkers*
5.1. Choosing which checkers to use *syntastic-filetype-checkers*
*'g:syntastic_<filetype>_checkers'*
You can tell syntastic which checkers to run for a given filetype by setting a
@ -756,7 +767,7 @@ are supported by syntastic: |syntastic-checkers|.
Use `:SyntasticInfo` to see which checkers are available for a given filetype.
------------------------------------------------------------------------------
5.2 Choosing the executable *syntastic-config-exec*
5.2. Choosing the executable *syntastic-config-exec*
*'syntastic_<filetype>_<checker>_exec'*
The executable run by a checker is normally defined automatically, when the
@ -773,7 +784,7 @@ takes precedence over both 'b:syntastic_<filetype>_<checker>_exec' and
'g:syntastic_<filetype>_<checker>_exec' in the buffers where it is defined.
------------------------------------------------------------------------------
5.3 Configuring specific checkers *syntastic-config-makeprg*
5.3. Configuring specific checkers *syntastic-config-makeprg*
Checkers are run by constructing a command line and by passing it to a shell
(see |'shell'| and |'syntastic_shell'|). In most cases this command line is
@ -797,7 +808,7 @@ The result is a command line of the form: >
All fields 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()". For example to
override the argguments and the tail: >
override the arguments and the tail: >
let g:syntastic_c_pc_lint_args = "-w5 -Iz:/usr/include/linux"
let g:syntastic_c_pc_lint_tail = "2>/dev/null"
<
@ -849,7 +860,7 @@ options that can be set they are normally documented in this manual (see
|syntastic-checkers|).
------------------------------------------------------------------------------
5.4 Sorting errors *syntastic-config-sort*
5.4. Sorting errors *syntastic-config-sort*
*'syntastic_<filetype>_<checker>_sort'*
Syntastic may decide to group the errors produced by some checkers by file,
@ -868,7 +879,7 @@ For aggregated lists (see |syntastic-aggregating-errors|) these variables are
ignored if |'syntastic_sort_aggregated_errors'| is set (which is the default).
------------------------------------------------------------------------------
5.5 Filtering errors *syntastic-config-filtering*
5.5. Filtering errors *syntastic-config-filtering*
*'syntastic_<filetype>_<checker>_quiet_messages'*
Finally, variables 'g:syntastic_<filetype>_<checker-name>_quiet_messages' can
@ -882,7 +893,7 @@ from the corresponding checkers are filtered. Example: >
The syntax is of course identical to that of |syntastic_quiet_messages|.
------------------------------------------------------------------------------
5.6 Debugging *syntastic-config-debug*
5.6. Debugging *syntastic-config-debug*
*syntastic-debug*
Syntastic can log a trace of its working to Vim's |message-history|. To verify
@ -902,7 +913,7 @@ Debug logs can be saved to a file; see |'syntastic_debug_file'| for details.
Setting |'syntastic_debug'| to 0 turns off logging.
------------------------------------------------------------------------------
5.7 Profiling *syntastic-profiling*
5.7. Profiling *syntastic-profiling*
A very useful tool for debugging performance problems is Vim's built-in
|profiler|. In order to enable profiling for syntastic you need to add two lines
@ -932,7 +943,7 @@ composite filetypes to simple ones using |'syntastic_filetype_map'|, e.g.: >
let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
<
------------------------------------------------------------------------------
6.2 Editing files over network *syntastic-netrw*
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
@ -940,7 +951,7 @@ of operation. It can only check files that can be accessed directly by local
checkers, without any translation or conversion.
------------------------------------------------------------------------------
6.3 The 'shellslash' option *syntastic-shellslash*
6.3. The 'shellslash' option *syntastic-shellslash*
The 'shellslash' option is relevant only on Windows systems. This option
determines (among other things) the rules for quoting command lines, and there
@ -951,7 +962,7 @@ shell. It should be turned off if your 'shell' (or |'syntastic_shell'|) is
value.
------------------------------------------------------------------------------
6.4 Saving Vim sessions *syntastic-sessions*
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': >
@ -961,7 +972,7 @@ This will prevent `:mksession` from saving |syntastic-error-window| as empty
quickfix windows.
------------------------------------------------------------------------------
6.5 The location list callback *syntastic-loclist-callback*
6.5. The location list callback *syntastic-loclist-callback*
*SyntasticCheckHook()*
Syntastic also gives you direct access to the list of errors. A function
@ -987,7 +998,17 @@ also affect window sizes.)
7. Compatibility with other software *syntastic-compatibility*
------------------------------------------------------------------------------
7.1 The csh and tcsh shells *syntastic-csh*
7.1. airline *syntastic-airline*
The "airline" Vim plugin (https://github.com/vim-airline/vim-airline) comes
packaged with a mechanism of showing flags on the |'statusline'| according
to your |'syntastic_stl_format'|. When using this plugin you do NOT need to
follow the recommendation outlined in the |syntastic-statusline-flag| section
above to modify your |'statusline'|; "airline" will make all necessary changes
automatically.
------------------------------------------------------------------------------
7.2. The csh and tcsh shells *syntastic-csh*
The "csh" and "tcsh" shells are mostly compatible with syntastic. However,
some checkers assume Bourne shell syntax for redirecting "stderr". For this
@ -996,7 +1017,7 @@ such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
7.2. Eclim *syntastic-eclim*
7.3. Eclim *syntastic-eclim*
Syntastic can be used together with "Eclim" (see http://eclim.org/). However,
by default Eclim disables syntastic's checks for the filetypes it supports, in
@ -1009,7 +1030,15 @@ run Eclim's validation for others. Please consult Eclim's documentation for
details.
------------------------------------------------------------------------------
7.3 The fish shell *syntastic-fish*
7.4. ferret *syntastic-ferret*
At the time of this writing syntastic conflicts with the "ferret" Vim plugin
(https://github.com/wincent/ferret). The "ferret" plugin assumes control over
loclist windows even when configured to use |quickfix| lists. This interferes
with syntastic's functioning.
------------------------------------------------------------------------------
7.5. 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
@ -1019,7 +1048,7 @@ original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
7.4. The fizsh shell *syntastic-fizsh*
7.6. 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
@ -1032,7 +1061,7 @@ interactive features of "fizsh". Using a more traditional shell such as "zsh",
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
7.5 flagship *syntastic-flagship*
7.7. 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"
@ -1042,7 +1071,7 @@ described in the |syntastic-statusline-flag| section above: >
autocmd User Flags call Hoist("window", "SyntasticStatuslineFlag")
<
------------------------------------------------------------------------------
7.6. powerline *syntastic-powerline*
7.8. 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
@ -1059,16 +1088,18 @@ packaged with a syntastic segment. To customize this segment create a file
}
<
------------------------------------------------------------------------------
7.7. The PowerShell shell *syntastic-powershell*
7.9. 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
'shell'. You may still run Vim from 'PowerShell', but you do have to point
Vim's 'shell' to a more traditional program, such as "cmd.exe": >
set shell=cmd.exe
At the time of this writing syntastic is not compatible with using
"PowerShell" (https://msdn.microsoft.com/en-us/powershell) as Vim's 'shell'.
You may still run Vim from "PowerShell", but you do have to point Vim's
'shell' to a more traditional program, such as "cmd.exe" on Windows, or
"/bin/sh" on UNIX: >
set shell=c:\Windows\system32\cmd.exe
set shell=/bin/sh
<
------------------------------------------------------------------------------
7.8 python-mode *syntastic-pymode*
7.10. 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
@ -1079,14 +1110,14 @@ for python in syntastic (see |'syntastic_mode_map'|), or disable lint checks in
let g:pymode_lint_on_write = 0
<
------------------------------------------------------------------------------
7.9. vim-auto-save *syntastic-vim-auto-save*
7.11. 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.10. vim-go *syntastic-vim-go*
7.12. vim-go *syntastic-vim-go*
Syntastic can be used along with the "vim-go" Vim plugin (see
https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run
@ -1103,7 +1134,7 @@ stick with |quickfix| lists: >
let g:go_list_type = "quickfix"
<
------------------------------------------------------------------------------
7.11. vim-virtualenv *syntastic-vim-virtualenv*
7.13. 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
@ -1111,7 +1142,7 @@ https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
"vim-virtualenv".
------------------------------------------------------------------------------
7.12 YouCompleteMe *syntastic-ycm*
7.14. YouCompleteMe *syntastic-ycm*
Syntastic can be used together with the "YouCompleteMe" Vim plugin (see
http://valloric.github.io/YouCompleteMe/). However, by default "YouCompleteMe"
@ -1122,7 +1153,7 @@ have to set |g:ycm_show_diagnostics_ui| to 0. E.g.: >
let g:ycm_show_diagnostics_ui = 0
<
------------------------------------------------------------------------------
7.13 The zsh shell and MacVim *syntastic-zsh*
7.15. The zsh shell and MacVim *syntastic-zsh*
If you're running MacVim together with the "zsh" shell (http://www.zsh.org/)
you need to be aware that MacVim does not source your .zshrc file, but will

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.7.0-193'
let g:_SYNTASTIC_VERSION = '3.7.0-226'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
@ -132,13 +132,19 @@ let s:_DEBUG_DUMP_OPTIONS = [
\ 'shellpipe',
\ 'shellquote',
\ 'shellredir',
\ 'shellslash',
\ 'shelltemp',
\ 'shellxquote'
\ ]
if exists('+shellxescape')
call add(s:_DEBUG_DUMP_OPTIONS, 'shellxescape')
endif
for s:feature in [
\ 'shellxescape',
\ 'shellslash',
\ 'autochdir',
\ ]
if exists('+' . s:feature)
call add(s:_DEBUG_DUMP_OPTIONS, s:feature)
endif
endfor
lockvar! s:_DEBUG_DUMP_OPTIONS
" debug constants
@ -163,6 +169,7 @@ let s:registry = g:SyntasticRegistry.Instance()
let s:notifiers = g:SyntasticNotifiers.Instance()
let s:modemap = g:SyntasticModeMap.Instance()
let s:_check_stack = []
let s:_quit_pre = []
" Commands {{{1
@ -207,7 +214,7 @@ command! SyntasticJavacEditConfig runtime! syntax_checkers/java/*.vim | Synta
" Public API {{{1
function! SyntasticCheck(...) abort " {{{2
call s:UpdateErrors(0, a:000)
call s:UpdateErrors(bufnr(''), 0, a:000)
call syntastic#util#redraw(g:syntastic_full_redraws)
endfunction " }}}2
@ -215,6 +222,8 @@ function! SyntasticInfo(...) abort " {{{2
call s:modemap.modeInfo(a:000)
call s:registry.echoInfoFor(s:_resolve_filetypes(a:000))
call s:_explain_skip(a:000)
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
endfunction " }}}2
function! SyntasticErrors() abort " {{{2
@ -222,19 +231,19 @@ function! SyntasticErrors() abort " {{{2
endfunction " }}}2
function! SyntasticReset() abort " {{{2
call s:ClearCache()
call s:ClearCache(bufnr(''))
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
endfunction " }}}2
function! SyntasticToggleMode() abort " {{{2
call s:modemap.toggleMode()
call s:ClearCache()
call s:ClearCache(bufnr(''))
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
call s:modemap.echoMode()
endfunction " }}}2
function! SyntasticSetLoclist() abort " {{{2
call g:SyntasticLoclist.current().setloclist()
call g:SyntasticLoclist.current().setloclist(0)
endfunction " }}}2
" }}}1
@ -243,54 +252,68 @@ endfunction " }}}2
augroup syntastic
autocmd!
autocmd BufEnter * call s:BufEnterHook()
autocmd VimEnter * call s:VimEnterHook()
autocmd BufEnter * call s:BufEnterHook(expand('<afile>', 1))
autocmd BufWinEnter * call s:BufWinEnterHook(expand('<afile>', 1))
augroup END
if g:syntastic_nested_autocommands
augroup syntastic
autocmd BufReadPost * nested call s:BufReadPostHook()
autocmd BufWritePost * nested call s:BufWritePostHook()
autocmd BufReadPost * nested call s:BufReadPostHook(expand('<afile>', 1))
autocmd BufWritePost * nested call s:BufWritePostHook(expand('<afile>', 1))
augroup END
else
augroup syntastic
autocmd BufReadPost * call s:BufReadPostHook()
autocmd BufWritePost * call s:BufWritePostHook()
autocmd BufReadPost * call s:BufReadPostHook(expand('<afile>', 1))
autocmd BufWritePost * call s:BufWritePostHook(expand('<afile>', 1))
augroup END
endif
if exists('##QuitPre')
" QuitPre was added in Vim 7.3.544
augroup syntastic
autocmd QuitPre * call s:QuitPreHook(expand('<amatch>', 1))
autocmd QuitPre * call s:QuitPreHook(expand('<afile>', 1))
augroup END
endif
function! s:BufReadPostHook() abort " {{{2
if g:syntastic_check_on_open
function! s:BufReadPostHook(fname) abort " {{{2
let buf = syntastic#util#fname2buf(a:fname)
if g:syntastic_check_on_open && buf > 0
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufReadPost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, [])
\ 'autocmd: BufReadPost, buffer ' . buf . ' = ' . string(a:fname))
if index(s:_check_stack, buf) == -1
call add(s:_check_stack, buf)
endif
endif
endfunction " }}}2
function! s:BufWritePostHook() abort " {{{2
function! s:BufWritePostHook(fname) abort " {{{2
let buf = syntastic#util#fname2buf(a:fname)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufWritePost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, [])
\ 'autocmd: BufWritePost, buffer ' . buf . ' = ' . string(a:fname))
call s:UpdateErrors(buf, 1, [])
endfunction " }}}2
function! s:BufEnterHook() abort " {{{2
function! s:BufEnterHook(fname) abort " {{{2
let buf = syntastic#util#fname2buf(a:fname)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufEnter, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))) .
\ ', &buftype = ' . string(&buftype))
if &buftype ==# ''
call s:notifiers.refresh(g:SyntasticLoclist.current())
\ 'autocmd: BufEnter, buffer ' . buf . ' = ' . string(a:fname) . ', &buftype = ' . string(&buftype))
if buf > 0 && getbufvar(buf, '&buftype') ==# ''
let idx = index(reverse(copy(s:_check_stack)), buf)
if idx >= 0
if !has('vim_starting')
call remove(s:_check_stack, -idx - 1)
call s:UpdateErrors(buf, 1, [])
endif
elseif &buftype ==# ''
call s:notifiers.refresh(g:SyntasticLoclist.current())
endif
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(buf, 'syntastic_owner_buffer'))
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
if !empty(get(w:, 'syntastic_loclist_set', [])) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call SyntasticLoclistHide()
@ -298,8 +321,39 @@ function! s:BufEnterHook() abort " {{{2
endif
endfunction " }}}2
function! s:BufWinEnterHook(fname) abort " {{{2
let buf = syntastic#util#fname2buf(a:fname)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufWinEnter, buffer ' . buf . ' = ' . string(a:fname) . ', &buftype = ' . string(&buftype))
if buf > 0 && getbufvar(buf, '&buftype') ==# ''
let idx = index(reverse(copy(s:_check_stack)), buf)
if idx >= 0 && !has('vim_starting')
call remove(s:_check_stack, -idx - 1)
call s:UpdateErrors(buf, 1, [])
endif
endif
endfunction " }}}2
function! s:VimEnterHook() abort " {{{2
let g:syntastic_version =
\ g:_SYNTASTIC_VERSION .
\ ' (Vim ' . v:version . (has('nvim') ? ', Neovim' : '') . ', ' .
\ g:_SYNTASTIC_UNAME .
\ (has('gui') ? ', GUI' : '') . ')'
lockvar g:syntastic_version
let buf = bufnr('')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: VimEnter, buffer ' . buf . ' = ' . string(bufname(buf)) . ', &buftype = ' . string(&buftype))
let idx = index(reverse(copy(s:_check_stack)), buf)
if idx >= 0 && getbufvar(buf, '&buftype') ==# ''
call remove(s:_check_stack, -idx - 1)
call s:UpdateErrors(buf, 1, [])
endif
endfunction " }}}2
function! s:QuitPreHook(fname) abort " {{{2
let buf = bufnr(fnameescape(a:fname))
let buf = syntastic#util#fname2buf(a:fname)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . buf . ' = ' . string(a:fname))
if !syntastic#util#var('check_on_wq')
@ -317,7 +371,7 @@ endfunction " }}}2
" Main {{{1
"refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
function! s:UpdateErrors(buf, auto_invoked, checker_names) abort " {{{2
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version')
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
@ -326,21 +380,21 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
call s:modemap.synch()
if s:_skip_file()
if s:_skip_file(a:buf)
return
endif
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
if run_checks
call s:CacheErrors(a:checker_names)
call syntastic#util#setChangedtick()
call s:CacheErrors(a:buf, a:checker_names)
call syntastic#util#setLastTick(a:buf)
else
if a:auto_invoked
return
endif
endif
let loclist = g:SyntasticLoclist.current()
let loclist = g:SyntasticLoclist.current(a:buf)
if exists('*SyntasticCheckHook')
call SyntasticCheckHook(loclist.getRaw())
@ -356,14 +410,8 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
let do_jump = 0
endif
let w:syntastic_loclist_set = []
if syntastic#util#var('always_populate_loc_list') || do_jump
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist (new)')
call setloclist(0, loclist.getRaw())
if !exists('b:syntastic_changedtick')
call syntastic#util#setChangedtick()
endif
let w:syntastic_loclist_set = [bufnr(''), b:syntastic_changedtick]
call loclist.setloclist(1)
if run_checks && do_jump && !loclist.isEmpty()
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: jump')
execute 'silent! lrewind ' . do_jump
@ -383,21 +431,24 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
endfunction " }}}2
"clear the loc list for the buffer
function! s:ClearCache() abort " {{{2
call s:notifiers.reset(g:SyntasticLoclist.current())
call b:syntastic_loclist.destroy()
function! s:ClearCache(buf) abort " {{{2
let loclist = g:SyntasticLoclist.current(a:buf)
call s:notifiers.reset(loclist)
call loclist.destroy()
endfunction " }}}2
"detect and cache all syntax errors in this buffer
function! s:CacheErrors(checker_names) abort " {{{2
function! s:CacheErrors(buf, checker_names) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' .
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
call s:ClearCache()
call s:ClearCache(a:buf)
let newLoclist = g:SyntasticLoclist.New([])
call newLoclist.setOwner(a:buf)
if !s:_skip_file()
if !s:_skip_file(a:buf)
" debug logging {{{3
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TERM = ' . string($TERM))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$PATH = ' . string($PATH))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
" }}}3
@ -436,7 +487,7 @@ function! s:CacheErrors(checker_names) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'sorted:', loclist)
endif
let newLoclist = newLoclist.extend(loclist)
call newLoclist.extend(loclist)
if !aggregate_errors
break
@ -556,7 +607,7 @@ function! SyntasticMake(options) abort " {{{2
let err_lines = call('syntastic#preprocess#' . a:options['preprocess'], [err_lines])
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'preprocess:', err_lines)
endif
lgetexpr err_lines
noautocmd lgetexpr err_lines
let errors = deepcopy(getloclist(0))
@ -569,6 +620,12 @@ function! SyntasticMake(options) abort " {{{2
catch /\m^Vim\%((\a\+)\)\=:E380/
" E380: At bottom of quickfix stack
call setloclist(0, [], 'r')
try
" Vim 7.4.2200 or later
call setloclist(0, [], 'r', { 'title': '' })
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
" do nothing
endtry
catch /\m^Vim\%((\a\+)\)\=:E776/
" E776: No location list
" do nothing
@ -660,10 +717,10 @@ function! s:_is_quitting(buf) abort " {{{2
endfunction " }}}2
" Skip running in special buffers
function! s:_skip_file() abort " {{{2
let fname = expand('%', 1)
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
function! s:_skip_file(buf) abort " {{{2
let fname = bufname(a:buf)
let skip = s:_is_quitting(a:buf) || getbufvar(a:buf, 'syntastic_skip_checks') ||
\ (getbufvar(a:buf, '&buftype') !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
\ getwinvar(0, '&previewwindow') || s:_ignore_file(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip
@ -674,17 +731,19 @@ endfunction " }}}2
" Explain why checks will be skipped for the current file
function! s:_explain_skip(filetypes) abort " {{{2
if empty(a:filetypes) && s:_skip_file()
let buf = bufnr('')
if empty(a:filetypes) && s:_skip_file(buf)
let why = []
let fname = expand('%', 1)
let fname = bufname(buf)
let bt = getbufvar(buf, '&buftype')
if s:_is_quitting(bufnr('%'))
if s:_is_quitting(buf)
call add(why, 'quitting buffer')
endif
if get(b:, 'syntastic_skip_checks', 0)
if getbufvar(buf, 'syntastic_skip_checks')
call add(why, 'b:syntastic_skip_checks set')
endif
if &buftype !=# ''
if bt !=# ''
call add(why, 'buftype = ' . string(&buftype))
endif
if !filereadable(fname)

View File

@ -25,10 +25,27 @@ function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
call a:loclist.show()
endif
else
if auto_loc_list == 1 || auto_loc_list == 2
"TODO: this will close the loc list window if one was opened by
"something other than syntastic
lclose
if (auto_loc_list == 1 || auto_loc_list == 2) && !empty(get(w:, 'syntastic_loclist_set', []))
try
" Vim 7.4.2200 or later
let title = get(getloclist(0, { 'title': 1 }), 'title', ':SyntasticCheck ')
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
let title = ':SyntasticCheck '
endtry
if strpart(title, 0, 16) ==# ':SyntasticCheck '
" TODO: this will close the loc list window if one was opened
" by something other than syntastic
call SyntasticLoclistHide()
try
" Vim 7.4.2200 or later
call setloclist(0, [], 'r', { 'title': '' })
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
" do nothing
endtry
let w:syntastic_loclist_set = []
endif
endif
endif
endfunction " }}}2

View File

@ -27,17 +27,18 @@ function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
return newObj
endfunction " }}}2
function! g:SyntasticLoclist.current() abort " {{{2
if !exists('b:syntastic_loclist') || empty(b:syntastic_loclist)
let b:syntastic_loclist = g:SyntasticLoclist.New([])
function! g:SyntasticLoclist.current(...) abort " {{{2
let buf = a:0 > 1 ? a:1 : bufnr('')
let loclist = getbufvar(buf, 'syntastic_loclist')
if type(loclist) != type({}) || empty(loclist)
unlet! loclist
let loclist = g:SyntasticLoclist.New([])
endif
return b:syntastic_loclist
return loclist
endfunction " }}}2
function! g:SyntasticLoclist.extend(other) abort " {{{2
let list = self.copyRaw()
call extend(list, a:other.copyRaw())
return g:SyntasticLoclist.New(list)
call extend(self._rawLoclist, a:other.copyRaw())
endfunction " }}}2
function! g:SyntasticLoclist.sort() abort " {{{2
@ -167,7 +168,6 @@ function! g:SyntasticLoclist.setOwner(buffer) abort " {{{2
endfunction " }}}2
function! g:SyntasticLoclist.deploy() abort " {{{2
call self.setOwner(bufnr(''))
let self._stamp = syntastic#util#stamp()
for buf in self.getBuffers()
call setbufvar(buf, 'syntastic_loclist', self)
@ -289,23 +289,29 @@ function! g:SyntasticLoclist.filter(filters) abort " {{{2
return filter(copy(self._rawLoclist), filter)
endfunction " }}}2
function! g:SyntasticLoclist.setloclist() abort " {{{2
function! g:SyntasticLoclist.setloclist(new) abort " {{{2
if !exists('w:syntastic_loclist_set')
let w:syntastic_loclist_set = []
endif
if empty(w:syntastic_loclist_set) || w:syntastic_loclist_set != [bufnr(''), b:changedtick]
let replace = g:syntastic_reuse_loc_lists && !empty(w:syntastic_loclist_set)
if a:new || empty(w:syntastic_loclist_set) || w:syntastic_loclist_set != [self._owner, getbufvar(self._owner, 'changedtick')]
let replace = !a:new && g:syntastic_reuse_loc_lists && !empty(w:syntastic_loclist_set)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
call syntastic#util#setChangedtick()
let w:syntastic_loclist_set = [bufnr(''), b:syntastic_changedtick]
try
" Vim 7.4.2200 or later
call setloclist(0, [], 'r', { 'title': ':SyntasticCheck ' . self._name })
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
" do nothing
endtry
call syntastic#util#setLastTick(self._owner)
let w:syntastic_loclist_set = [self._owner, getbufvar(self._owner, 'syntastic_lasttick')]
endif
endfunction " }}}2
"display the cached errors for this buf in the location list
function! g:SyntasticLoclist.show() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
call self.setloclist()
call self.setloclist(0)
if !self.isEmpty()
let num = winnr()

View File

@ -72,7 +72,7 @@ function! g:SyntasticModeMap.echoMode() abort " {{{2
endfunction " }}}2
function! g:SyntasticModeMap.modeInfo(filetypes) abort " {{{2
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION . ' (Vim ' . v:version . ', ' . g:_SYNTASTIC_UNAME . ')'
echomsg 'Syntastic version: ' . g:syntastic_version
let type = len(a:filetypes) ? a:filetypes[0] : &filetype
echomsg 'Info for filetype: ' . type

View File

@ -23,7 +23,7 @@ function! g:SyntasticNotifiers.Instance() abort " {{{2
endfunction " }}}2
function! g:SyntasticNotifiers.refresh(loclist) abort " {{{2
if !a:loclist.isEmpty() && !a:loclist.isNewerThan([])
if !syntastic#util#bufIsActive(bufnr('')) || (!a:loclist.isEmpty() && !a:loclist.isNewerThan([]))
" loclist not fully constructed yet
return
endif

View File

@ -339,7 +339,10 @@ endfunction " }}}2
" Check for obsolete variable g:syntastic_<filetype>_checker
function! g:SyntasticRegistry._checkDeprecation(filetype) abort " {{{2
if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers')
if exists('g:syntastic_' . a:filetype . '_checker') &&
\ !exists('g:syntastic_' . a:filetype . '_checkers') &&
\ type(g:syntastic_{a:filetype}_checker) == type('')
let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker]
call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated')
endif

View File

@ -31,12 +31,12 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict
let errorformat =
\ '%-Z %#,'.
\ '%W%f:%l:%v: Warning: %m,'.
\ '%W%f:%l:%v: Warning:,'.
\ '%E%f:%l:%v: %m,'.
\ '%E%>%f:%l:%v:,'.
\ '%W%\m%f:%l:%v%\%%(-%\d%\+%\)%\=: Warning: %m,'.
\ '%W%\m%f:%l:%v%\%%(-%\d%\+%\)%\=: Warning:,'.
\ '%E%\m%f:%l:%v%\%%(-%\d%\+%\)%\=: %m,'.
\ '%E%>%\m%f:%l:%v%\%%(-%\d%\+%\)%\=:,'.
\ '%+C %#%m,'.
\ '%W%>%f:%l:%v:,'.
\ '%W%>%\m%f:%l:%v%\%%(-%\d%\+%\)%\=:,'.
\ '%+C %#%tarning: %m,'
return SyntasticMake({

View File

@ -25,7 +25,7 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 6])
return syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [0, 18, 1])
endfunction
function! SyntaxCheckers_javascript_flow_GetLocList() dict

View File

@ -47,7 +47,7 @@ endfunction
function! SyntaxCheckers_lua_luac_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-p' })
let errorformat = 'luac: %#%f:%l: %m'
let errorformat = '%*\f: %#%f:%l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,