python - Vim PEP-8 插件的配置设置以忽略错误和警告?

标签 python vim pep8

我正在使用这个插件来检测 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/

相关文章:

python - python 中的 "Method overloading"

Python sockets连接超时问题

vim - 在 Vim 中,有没有一种不那么笨拙的方式来做一次性高光?

function - 编写一个 vim 函数来插入静态文本 block

python - 分割这条线的最pythonic方式?

python - 验证码识别准确率低

regex - 如何用一些文本替换 VIM 中的捕获组 2

python - 如何打破 PEP8 合规性的长字符串?

python - 如何按照 PEP8 规则缩写维度?

python - scipy.stats.chisquare 没有给出输入数据预期的结果