Using :SyntasticToggleMode
you can toggle Syntastic into passive mode, which will disable auto-checking. You can then check a file by running :SyntasticCheck
instead.
For more, see :help syntastic-commands
On another note: if Syntastic is slow for you consider trying ale as an alternative. Unlike Syntastic it runs asynchronously, so even if it's slow it shouldn't hinder you.
I have disabled Syntastic by default and activate/disable error checking with the following in my .vimrc:
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
nnoremap <C-w>E :SyntasticCheck<CR>
When I need to use error checking I simply hit: ctrl-w E
Alternative to Jamie and gospes answers, one can disable the checker completely by specifying the checker like so:
let g:syntastic_html_checkers=['']
Also make sure the syntastic_check_on_open
isn't set to 1, which will countermand the above line:
let g:syntastic_check_on_open = 0
You could turn Syntastic off for the entire session (as answered by Jamie Schembri), but if it's just a problem with the one "very big file", you may want to disable just the one buffer.
A few of the files I work on at my job are hopelessly non-PSR compliant. Most work just fine. I was looking for functionality to disable Syntastic for just those problem files. A simpler form of the 'SyntasticDisableToggle' solution outlined by the primary contributor works for me:
"disable syntastic on a per buffer basis (some work files blow it up)
function! SyntasticDisableBuffer()
let b:syntastic_skip_checks = 1
SyntasticReset
echo 'Syntastic disabled for this buffer'
endfunction
command! SyntasticDisableBuffer call SyntasticDisableBuffer()
Because this doesn't affect other buffers, I can keep using this awesome plugin for any other (partially) compliant files I have open.
This doesn't directly address the question, but can help beyond the current session. If you have a file that you must edit often but which you know that you will always want to disable Syntastic on (e.g. it has thousands of errors and you intend not to fix them, and leaving it on results in UI slowdown), then permanently blacklisting it is very convenient.
To do this, use the syntastic_ignore_files
option. It's tucked away in the help, but you can use regexes with this feature to blacklist files.
'syntastic_ignore_files'
Default: []
Use this option to specify files that syntastic should never check. It's a
list of regular-expression patterns. The full paths of files (see ::p) are
matched against these patterns, and the matches are case sensitive. Use \c
to specify case insensitive patterns. Example:
let g:syntastic_ignore_files = ['\m^/usr/include/', '\m\c\.h$']
The following settings worked for me.
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
noremap <C-w>e :SyntasticCheck<CR>
noremap <C-w>f :SyntasticToggleMode<CR>
Ctrl-w + e shall enable checking
Ctrl-w + f shall disable checking
To disable warnings use:
let g:syntastic_quiet_messages={'level':'warnings'}
Similarly to those mentioned by a few others, here's a vimrc segment that will turn off Syntastic by default, but maps a button (here, F10) to check the current file, and uses the same button as a toggle to turn off the checks. It's a little slow, but works.
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_mode_map = {'mode':'passive'}
nnoremap <F10> :SyntasticCheck<CR> :SyntasticToggleMode<CR> :w<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With