加载时出现慢性 ripgrep/vim 插件错误:“-complete 使用而没有 -nargs"? [英] Chronic ripgrep / vim Plugin Error on Load: "-complete Used Without -nargs"?
问题描述
我最近将 ripgrep 添加到了我的 vim 插件 列表中,并且在安装后立即开始在加载 vim 时收到此错误消息:
I recently added ripgrep to my list of vim plugins and, immediately after installation, I began receiving this error message whenever I loaded up vim:
Error detected while processing /Users/my_macbook/.vim/plugged/vim-ripgrep/plugin/vim-ripgrep.vim:
line 149: E1208: -complete used without -nargs
Press ENTER or type command to continue
打开有问题的文件并查看第 148-149 行发现:
Opening the offending file and reviewing lines 148-149 reveals:
148 command! -nargs=* -complete=file Rg :call s:Rg(<q-args>)
149 command! -complete=file RgRoot :call s:RgShowRoot()
我很好&在这里真的超出了我的深度,特别是考虑到这个错误是通过简单地安装插件产生的;我对底层文件 (vim-ripgrep.vim
) 进行了 0 次更改.
I am well & truly out of my depth here, especially considering that this error was generated by simply installing the plugin; I've made 0 changes to the underlying file (vim-ripgrep.vim
).
有没有人在安装 ripgrep 后遇到过类似的长期错误,如果有,您是如何解决的?
推荐答案
恭喜,您在 FOSS 程序中发现了一个错误.下一步是通过他们的问题跟踪器通知维护者,或者,如果您知道如何修复它,则提交补丁.
Congratulations, you have found a bug in a FOSS program. Next step is to either notify the maintainer via their issue tracker or, if you know how to fix it, submit a patch.
举个例子,作者分配了一个完成方法,-complete=file
,但是像:RgRoot
这样的自定义命令默认不接受参数,所以命令使没有意义原样:如果你不能传递参数,你就不能完成参数.
Case in point, the author assigns a completion method, -complete=file
, but custom commands like :RgRoot
don't accept arguments by default so the command makes no sense as-is: you can't complete arguments if you can't pass arguments.
它只需要一个 -nargs=*
,就像它楼上的邻居,:Rg
,才能正常工作,错误信息也很清楚:
It only needs a -nargs=*
, like its upstairs neighbour, :Rg
, to work properly and the error message is pretty clear about it:
line 149: E1208: -complete used without -nargs
参见:help -complete
、:help -nargs
,以及更一般的:help user-commands
.
See :help -complete
, :help -nargs
, and more generally, :help user-commands
.
这篇关于加载时出现慢性 ripgrep/vim 插件错误:“-complete 使用而没有 -nargs"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!