Syntastic and Python-mode together?
Asked Answered
O

4

13

I have installed python-mode in VIM. But I also have Syntastic installed. Since both do syntax checking, is there going to be a conflict? How can I turn off Syntastic for Python files?

Thanks for any help

Ob answered 6/10, 2013 at 13:2 Comment(0)
R
14

To expand on @abjuk's answer, you can disable based on file extension with:

let g:syntastic_ignore_files = ['\.py$']

This will only work for files that end in .py, though. It won't work for other files in where Vim thinks that filetype=python. For example, a file that starts with a shebang like #!/usr/bin/env python will still put Vim into python mode.

Syntastic also supports syntastic_mode_map (see :h syntastic_mode_map), which the docs seem to indicate should allow disabling based on the filetype, but I can't get it to work.

Another option is to leave Syntastic enabled, and disable python-mode's syntax checking:

let g:pymode_lint = 0

This is what I use, because I prefer Syntastic. It resolves the conflict, although it isn't exactly what you asked.

Rockett answered 7/10, 2013 at 16:51 Comment(0)
G
6

This is answered in the manual (see :help 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_on_write to 0. E.g.:

let g:pymode_lint_on_write = 0
Girandole answered 27/1, 2015 at 14:42 Comment(0)
G
1

I don't work in python, so I can't tell you if there will be a conflict, but you can turn off Syntastic for python files - see :h syntastic_ignore_files.

Gegenschein answered 6/10, 2013 at 13:16 Comment(1)
Okay that sounds like a good idea. It's safer to do that as Python Mode is supposed to do syntax checking anyway. Another issue is that Syntastic does not detect any errors in my java or C code - or when it does, it's all nonsense. It marks correct code that compiles as invalid and doesn't detect syntactically invalid code. Any ideas?Ob
D
0

I use the following to disable syntastic (not let syntastic trigger on file write) for Vim buffers which have the filetype python:

autocmd FileType python let g:syntastic_check_on_wq = 0

See my .vimrc.

Defection answered 23/6, 2014 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.