Remove support for YCM.

YCM has now its own navigation functions, so there is no longer any need
to call it from syntastic.

g:syntastic_delayed_redraws is also gone.  Syntastic doesn't use popup
menus, and the only purpose of this variable was to provide a workaround
for a problem triggered by YCM.

References:
https://github.com/Valloric/YouCompleteMe/pull/763
This commit is contained in:
LCD 47 2014-01-20 10:29:06 +02:00
parent d7d7cb1662
commit 6c9735335f
8 changed files with 89 additions and 214 deletions

View File

@ -19,11 +19,11 @@
Syntastic is a syntax checking plugin for vim that runs files through external syntax
checkers and displays any resulting errors to the user. This can be done on
demand, or automatically as files are saved. If syntax errors are detected, the
user is notified and is happy because they didn't have to compile their code or
execute their script to find them.
Syntastic is a syntax checking plugin for Vim that runs files through external
syntax checkers and displays any resulting errors to the user. This can be done
on demand, or automatically as files are saved. If syntax errors are detected,
the user is notified and is happy because they didn't have to compile their
code or execute their script to find them.
At the time of this writing, syntax checking plugins exist for ActionScript,
Ada, AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript,
@ -41,7 +41,7 @@ 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
enabled.
![Screenshot 1](https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png)
![Screenshot 1][0]
1. Errors are loaded into the location list for the corresponding window.
2. When the cursor is on a line containing an error, the error message is echoed in the command window.
@ -57,9 +57,9 @@ have pathogen working then skip Step 1 and go to Step 2.
### Step 1: Install pathogen.vim
First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) so that
it's easy to install syntastic. Do this in your Terminal so that you get the pathogen.vim file
and the directories it needs:
First I'll show you how to install tpope's [pathogen.vim][1] so that it's
easy to install syntastic. Do this in your Terminal so that you get the
pathogen.vim file and the directories it needs:
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
@ -90,86 +90,140 @@ step 1 and make sure you did the following:
4. Have permissions to access all of these directories.
## Google group
To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic).
## FAQ
__Q. I installed syntastic but it isn't reporting any errors...__
A. The most likely reason is that none of the syntax checkers that it requires is installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executables are supported, just look in `syntax_checkers/<filetype>/*.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. You can see syntastic's idea of available checkers by running `:SyntasticInfo`.
A. The most likely reason is that none of the syntax checkers that it requires
is installed. For example: python requires either `flake8`, `pyflakes`
or `pylint` to be installed and in `$PATH`. To see which executables are
supported, just look in `syntax_checkers/<filetype>/*.vim`. Note that aliases
do not work; the actual executable must be available in your `$PATH`. Symbolic
links are okay. You can see syntastic's idea of available checkers by running
`:SyntasticInfo`.
Another reason it could fail is that either the command line options 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 create an issue - or better yet, create a pull request.
Another reason it could fail is that either the command line options 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
create an issue - or better yet, create a pull request.
__Q. Recently some of my syntax checker options have stopped working...__
A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `makeprgBuild()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options.
A. The options are still there, they have just been renamed. Recently,
almost all syntax checkers were refactored to use the new `makeprgBuild()`
function. This made a lot of the old explicit options redundant - as they are
now implied. The new implied options usually have slightly different names to
the old options.
e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntastic_php_phpcs_args`. This completely overrides the arguments of the checker, including any defaults, so you may need to look up the default arguments of the checker and add these in.
e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use
`g:syntastic_php_phpcs_args`. This completely overrides the arguments of
the checker, including any defaults, so you may need to look up the default
arguments of the checker and add these in.
See `:help syntastic-checker-options` for more information.
__Q. I run a checker and the location list is not updated...__
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:
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
```
__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 are:
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 are:
```vim
syntastic_<filetype>_<subchecker>_args
```
So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc:
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.
__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__
__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:
```vim
let g:syntastic_<filetype>_checkers=['<checker-name>']
```
To see the list of checkers for your filetype, look in `syntax_checkers/<filetype>/`.
To see the list of checkers for your filetype, look in
`syntax_checkers/<filetype>/`.
e.g. Python has the following checkers: `flake8`, `pyflakes`, `pylint` and a native `python` checker.
e.g. Python has the following checkers: `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']
```
Some filetypes, like PHP, have style checkers as well as syntax checkers. These can be chained together like this:
Some filetypes, like PHP, have style checkers as well as syntax checkers. These
can be chained together like this:
```vim
let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']
```
This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`.
This is telling syntastic to run the `php` checker first, and if no errors are
found, run `phpcs`, and then `phpmd`.
__Q. How can I jump between the different errors without using the location list at the bottom of the window?__
__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 `:help :lprev`.
A. Vim provides several built in commands for this. See `:help :lnext` and
`:help :lprev`.
If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things).
If you use these commands a lot then you may want to add shortcut mappings to
your vimrc, or install something like [unimpaired][2], which provides such
mappings (among other things).
__Q. A syntax checker is giving me unwanted/strange style tips?__
A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers) to see what options are available.
A. Some filetypes (e.g. php) have style checkers as well as syntax
checkers. You can usually configure the options that are passed to the style
checkers, or just disable them. Take a look at the [wiki][3] to see what
options are available.
__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__
__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:
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 lclose\|bdelete
```
## Other resources
The preferred place for posting suggestions, reporting bugs, and general
discussions related to syntastic is the [issue tracker at GitHub][4]. There
are also a [google group][5], and a [syntastic tag at StackOverflow][6].
Syntastic aims to provide a common interface to syntax checkers for as many
languages as possible. For particular languages, there are, of course, other
plugins that provide more functionality than syntastic. You might want to take
a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
[1]: https://github.com/tpope/vim-pathogen
[2]: https://github.com/tpope/vim-unimpaired
[3]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
[4]: https://github.com/scrooloose/syntastic/issues
[5]: https://groups.google.com/group/vim-syntastic
[6]: http://stackoverflow.com/questions/tagged/syntastic
[7]: https://github.com/davidhalter/jedi-vim
[8]: https://github.com/klen/python-mode
[9]: https://github.com/Valloric/YouCompleteMe

View File

@ -18,7 +18,6 @@ let s:global_options = [
\ 'syntastic_check_on_open',
\ 'syntastic_check_on_wq',
\ 'syntastic_debug',
\ 'syntastic_delayed_redraws',
\ 'syntastic_echo_current_error',
\ 'syntastic_enable_balloons',
\ 'syntastic_enable_highlighting',

View File

@ -6,30 +6,10 @@ let g:loaded_syntastic_util_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_delayed_redraws')
let g:syntastic_delayed_redraws = 0
endif
" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen()
" and hope for the best :)
let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
let s:redraw_delayed = 0
let s:redraw_full = 0
if g:syntastic_delayed_redraws
" CursorHold / CursorHoldI events are triggered if user doesn't press a
" key for &updatetime ms. We change it only if current value is the default
" value, that is 4000 ms.
if &updatetime == 4000
let &updatetime = 500
endif
augroup syntastic
autocmd CursorHold,CursorHoldI * call syntastic#util#redrawHandler()
augroup END
endif
" Public functions {{{1
function! syntastic#util#isRunningWindows()
@ -216,24 +196,11 @@ function! syntastic#util#decodeXMLEntities(string)
return str
endfunction
" On older Vim versions calling redraw while a popup is visible can make
" Vim segfault, so move redraws to a CursorHold / CursorHoldI handler.
function! syntastic#util#redraw(full)
if !g:syntastic_delayed_redraws || !pumvisible()
call s:doRedraw(a:full)
let s:redraw_delayed = 0
let s:redraw_full = 0
if a:full
redraw!
else
let s:redraw_delayed = 1
let s:redraw_full = s:redraw_full || a:full
endif
endfunction
function! syntastic#util#redrawHandler()
if s:redraw_delayed && !pumvisible()
call s:doRedraw(s:redraw_full)
let s:redraw_delayed = 0
let s:redraw_full = 0
redraw
endif
endfunction
@ -250,21 +217,6 @@ endfunction
" Private functions {{{1
"Redraw in a way that doesnt make the screen flicker or leave anomalies behind.
"
"Some terminal versions of vim require `redraw!` - otherwise there can be
"random anomalies left behind.
"
"However, on some versions of gvim using `redraw!` causes the screen to
"flicker - so use redraw.
function! s:doRedraw(full)
if a:full
redraw!
else
redraw
endif
endfunction
function! s:translateFilter(filters)
let conditions = []
for [k, v] in items(a:filters)

View File

@ -465,15 +465,6 @@ Changing it can in principle make screen redraws smoother, but it can also
cause screen to flicker, or cause ghost characters. Leaving it to the default
should be safe.
*'syntastic_delayed_redraws'*
Default: 0
On older Vims, calling redraw when a popup menu is visible can cause Vim to
segfault. If your version of Vim is affected, the solution is of course to
upgrade Vim. If upgrading is not immediately feasible however, setting this
variable to 1 might help, by delaying redraws until they are safe. Beware that
there are functional and performance penalties involved, so only enable this
if you actually need it.
*'syntastic_debug'*
Default: 0
Set this to the sum of one or more of the following flags to enable

View File

@ -1,34 +0,0 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"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_c_ycm_checker")
finish
endif
let g:loaded_syntastic_c_ycm_checker = 1
function! SyntaxCheckers_c_ycm_IsAvailable() dict
return exists('g:loaded_youcompleteme')
endfunction
if !exists('g:loaded_youcompleteme')
finish
endif
function! SyntaxCheckers_c_ycm_GetLocList() dict
return youcompleteme#CurrentFileDiagnostics()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'ycm'})
" vim: set et sts=4 sw=4:

View File

@ -1,29 +0,0 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"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_cpp_ycm_checker")
finish
endif
let g:loaded_syntastic_cpp_ycm_checker = 1
runtime! syntax_checkers/c/*.vim
if !exists('g:loaded_youcompleteme')
finish
endif
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'ycm',
\ 'redirect': 'c/ycm'})
" vim: set et sts=4 sw=4:

View File

@ -1,29 +0,0 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"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_objc_ycm_checker")
finish
endif
let g:loaded_syntastic_objc_ycm_checker = 1
runtime! syntax_checkers/c/*.vim
if !exists('g:loaded_youcompleteme')
finish
endif
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objc',
\ 'name': 'ycm',
\ 'redirect': 'c/ycm'})
" vim: set et sts=4 sw=4:

View File

@ -1,29 +0,0 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"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_objcpp_ycm_checker")
finish
endif
let g:loaded_syntastic_objcpp_ycm_checker = 1
if !exists('g:loaded_youcompleteme')
finish
endif
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objcpp',
\ 'name': 'ycm',
\ 'redirect': 'c/ycm'})
" vim: set et sts=4 sw=4: