Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntastic and Python-mode together?

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

like image 370
user798275 Avatar asked Oct 06 '13 13:10

user798275


2 Answers

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.

like image 155
Jim Stewart Avatar answered Oct 05 '22 08:10

Jim Stewart


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
like image 29
lcd047 Avatar answered Oct 05 '22 07:10

lcd047