Vim Error detected while processing function <SNR>59_RunPyflakes: line 53: E927: Invalid action: ''

本文详细介绍了在安装vim配置后遇到的pyflakes错误,并提供了具体的解决方案,包括如何修改vim配置文件以解决E927: Invalid action的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装vim配置后,vim python文件报错:
Error detected while processing function 59_RunPyflakes:
line 53:
E927: Invalid action: ‘’

解决办法:修改 call setqflist(b:qf_list, ‘’) ==> call setqflist(b:qf_list, ’ ‘)
及’'中间加个空格
我自己环境修改文件的patch:
— a/vimconf/vimfiles/bundle/pyflakes/ftplugin/python/pyflakes.vim
+++ b/vimconf/vimfiles/bundle/pyflakes/ftplugin/python/pyflakes.vim
@@ -267,7 +267,7 @@ EOF
call setqflist(b:qf_list, ‘r’)
else
" one pyflakes quickfix window for all buffer

  •            call setqflist(b:qf_list, '')
    
  •            call setqflist(b:qf_list, ' ')
               let s:pyflakes_qf = s:GetQuickFixStackCount()
           endif
       endif
    

配置安装vim sh、python、rym配置:
GET CODE
$ cd $CONFDIR
$ git clone https://github.com/jaypei/exz-conf.git
$ cd exz-conf
$ git submodule init
$ git submodule update
VIM CONFIG
install
$ ln -s $CONFDIR/exz-conf/vimconf/_vimrc ~/.vimrc
$ ln -s $CONFDIR/exz-conf/vimconf/_gvimrc ~/.gvimrc
$ ln -s $CONFDIR/exz-conf/vimconf/vimfiles ~/.vim
$ ln -s $CONFDIR/exz-conf/vimconf/pylint.ini ~/.pylintrc

<think>我们正在处理一个关于Vim插件错误的问题:E1208: -complete used without allowing arguments 这个错误通常发生在定义自定义命令时,使用了-complete选项但没有指定命令可以接受参数(通过-attribute指定参数数量或范围)。 根据Vim文档,当使用:command定义命令时,如果使用了-complete选项,则必须同时使用-nargs选项来指定命令接受的参数数量(如0, 1, *, ?等)。否则会报错E1208。 因此,解决方法是:在定义命令时,确保如果使用了-complete,则必须同时使用-nargs来指定参数数量。 例如,错误的定义可能是: :command -complete=file MyCommand 正确的定义应该是(假设命令接受一个参数): :command -nargs=1 -complete=file MyCommand 或者,如果命令不接受参数,但使用了-complete,则应该指定-nargs=0: :command -nargs=0 -complete=file MyCommand 但是,通常如果命令不接受参数,我们不会使用-complete,因为补全没有意义。所以这种情况很少见。 因此,用户需要检查报错的插件代码,找到对应的:command定义,并添加合适的-nargs选项。 由于用户遇到的是插件错误,建议用户: 1. 定位到报错的代码行(Vim会提示错误发生在哪个文件哪一行)。 2. 查看该行附近的:command定义,检查是否在使用了-complete的地方缺少了-nargs。 3. 添加合适的-nargs选项。 如果用户不想修改插件代码,可以尝试联系插件作者修复。 另外,有时候这个错误可能是由于插件的兼容性问题(比如新版本的Vim要求更严格)导致的,检查插件是否有更新。 现在,我们来生成相关问题。</think>### 解决Vim插件加载错误 E1208: -complete used without allowing arguments 这个错误发生在Vim插件中定义自定义命令时使用了`-complete`参数但未指定`-nargs`参数。Vim要求当使用自动补全功能(`-complete`)时,必须明确声明命令接受的参数数量(`-nargs`)[^1]。 #### 解决步骤: 1. **定位问题代码** 在插件文件中搜索`:command`定义,找到同时包含`-complete`但缺少`-nargs`的语句: ```vim " 错误示例:缺少-nargs :command -complete=customlist,MyCompleteFunc MyCommand ``` 2. **添加-nargs参数** 根据命令需求添加合适的参数声明: ```vim " 正确示例:添加-nargs=1表示接受1个参数 :command -nargs=1 -complete=customlist,MyCompleteFunc MyCommand ``` 3. **常用-nargs值**: - `-nargs=0`:无参数 - `-nargs=1`:1个参数 - `-nargs=*`:任意数量参数(含0个) - `-nargs=?`:0或1个参数 - `-nargs=+`:至少1个参数 4. **临时修复(不修改插件)** 在vimrc中添加忽略错误(不推荐): ```vim silent! command ... " 使用silent!抑制错误 ``` #### 示例修复前后对比 ```diff " 修复前(触发E1208) - :command -complete=file FindFile " 修复后(添加-nargs=1) + :command -nargs=1 -complete=file FindFile ``` > **根本原因**:Vim要求`-complete`必须与`-nargs`配对使用,以确保补全系统知道如何处理参数边界。该设计可追溯至Vim 7.4的补全机制更新[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值