我正在使用这个插件来检测 Vim 中的 PEP-8 错误和警告: http://www.vim.org/scripts/script.php?script_id=3430
我想忽略后端 pep8 工具中给出的一些错误和警告,例如 E501 和 W601: http://pypi.python.org/pypi/pep8
当我查看插件代码时,我可以看到它支持这个:
from pep8checker import Pep8Checker
args = vim.eval('string(g:pep8_args)')
select = vim.eval('string(g:pep8_select)')
ignore = vim.eval('string(g:pep8_ignore)')
if select:
args = args + ' --select=%s' % select
if ignore:
args = args + ' --ignore=%s' % ignore
pep8_checker = Pep8Checker(cmd, args)
但是我该如何使用呢?
最佳答案
对于那些偶然发现这个问题并且上述答案不起作用的人,这里有一些其他 Vim Python 插件的解决方案:
对于 Syntastic :
let g:syntastic_python_checker="flake8"
let g:syntastic_python_checker_args="--ignore=E501,W601"
更新:新版本的 Syntastic 改用这个:
let g:syntastic_python_checkers=["flake8"]
对于 python-mode :
let g:pymode_lint_ignore="E501,W601"
确保在触发 Pathogen 或 Vundle 之前设置这些设置。
关于python - Vim PEP-8 插件的配置设置以忽略错误和警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9714302/