Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top