Last Updated: February 25, 2016
·
9.953K
· caioariede

Vim: Checking Python code on the fly

Syntastic is a syntax checking plugin that runs files through external syntax checkers and displays any resulting errors to the user. This can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them.

cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git

Add Python support

It requires either flake8, pyflakes or pylint to be installed. I prefer to use flake8 that merges pyflakes and pep8 functionality.

pip install flake8

Check file syntax on open

This is optional but useful. Otherwise Syntastic will only check syntax after saving the file.

let g:syntastic_check_on_open = 1