简体   繁体   中英

What Vim script you recommend for checking Python syntax on the fly?

I have visited Vim website , script section and found several synthax checkers for python. But which one to choose ? I would prefer something that supports python 3 as well, even though I code in python 2.6 currently.

Do all these checkers need a module like pychecker and pyflakes ?

I could install the most popular from scripts database but I thought to get some recommendations here first from what you consider the best and why. The script will have to work MACOS, windows and ubuntu, with MACOS being my highest priority.

In case you are wondering I am looking for syntax checking like the one used by PyDev in Eclipse IDE which underlines with a red wavy line all erros as you type.

These two websites really boosted my Vim productivity with all languages:

http://nvie.com/posts/how-i-boosted-my-vim/

http://stevelosh.com/blog/2010/09/coming-home-to-vim/

I use the PyFlakes vim script , and I'm pretty satisfied with it. Also, if you'd like PEP8 checking, try this script .

I'm using Syntastic plugin. It's working great so far. I use it instead of just pyflakes (Syntastic uses Pyflakes) because when doing Python development, I develop for web, so I need to edit Javascript and well and having a validation on the fly for various languages is a plus.

This question was asked in 2010, but as of now, you have a simple solution.
After the release of Vim 8 in September 2016, which supports asynchronous I/O support, you can use Asynchronous Lint Engine .
It supports most major languages, and of course you have to install the linter yourself or it won't work.
Be aware that it conflicts with syntastic , so you'd better disable or remove it if you have it installed.

Whether or not wavy red lines are displayed is related to the theme you're using, not the syntax checker or language. So long as your syntax file (try http://www.vim.org/scripts/script.php?script_id=790 ) checks for errors, you can show the errors with something like:

:hi Error           guifg=#ff0000 gui=undercurl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM