Skip to content

Instantly share code, notes, and snippets.

@eddieantonio
Last active March 27, 2018 22:15
Show Gist options
  • Save eddieantonio/c096c780cf09c938e031 to your computer and use it in GitHub Desktop.
Save eddieantonio/c096c780cf09c938e031 to your computer and use it in GitHub Desktop.
Vim Syntastic: automatically switch between python2 and python3 syntax checkers.
" Place this file in {VIMHOME}/after/ftplugin/python.vim
" Must have syntastic >= 3.5.0-29
" Use Python 3 when the shebang calls for it.
let b:syntastic_python_python_exec =
\ syntastic#util#parseShebang()['exe'] =~# '\m\<python3'
\ ? 'python3'
\ : 'python'
#!/usr/bin/env python3
def generator():
yield from range(10)
#!/usr/bin/env python
print "This is Python 2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment