vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.3k stars 1.14k forks source link

How can I disable Syntastic active mode if opened read-only (via "view" command) #2405

Closed househead closed 2 years ago

househead commented 2 years ago

I would ideally like to disable syntax checking when a file is opened read-only. Is this possible?

lcd047 commented 2 years ago

You could try setting an autocmd:

autocmd BufRead * if &readonly | let b:syntastic_mode = 'passive' | endif

(not tested). But this only makes sense for checkers that check a single file.

On a side note: syntastic is dead, you might consider switching to ALE which takes advantage of Vim 8 features and is actively maintained.

househead commented 2 years ago

Thank you, @lcd047 this meets my need well.

I'll have a look at ALE when I get a little more time! All the best.