Chronic ripgrep / vim Plugin Error on Load: "-complete Used Without -nargs"?
Asked Answered
Q

4

9

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

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()

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).

Has anyone encountered a similarly chronic error after installing ripgrep and, if so, how did you resolve it?

Quadrisect answered 26/7, 2021 at 15:48 Comment(0)
D
6

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.

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.

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

See :help -complete, :help -nargs, and more generally, :help user-commands.

Demirelief answered 26/7, 2021 at 16:18 Comment(0)
A
5

As the other answer stated, it is a bug in this plugin. There is a currently open pull request to fix this: https://github.com/jremmen/vim-ripgrep/pull/58 Unfortunately, the repository is currently unmaintained, so it is unlikely to be merged any time soon. This active forks page may help you identify a new maintainer.

Until there is a new maintainer for vim-ripgrep, I suggest checking out that branch in your ~/.vim/plugged/vim-ripgrep directory and reopening vim.

Autochthon answered 5/8, 2021 at 17:22 Comment(2)
People should not be dissuaded from using the fix by the fact that they won't be getting ripgrep updates since vim-ripgrep's master branch has not been changed in 3 years. Getting this warning every time you are trying to vim a file is really annoying.Grunt
@Grunt true. I was going to edit this to say as much but got sidetracked. I will do that now.Autochthon
F
3

I met the functionally same error on VIM plugins while using vim ~/.vimrc.

My met error liking yours:

Error detected while processing /Users/my_macbook/.vim/plugged/vim-ripgrep

/plugin/vim-ripgrep.vim:

I fixed the upstairs with the below:

cd /Users/my_macbook/.vim/plugged/vim-ripgrep/plugin/

git pull --rebase

END!

Forborne answered 8/5, 2022 at 8:23 Comment(0)
N
1

If you are using vim-plug, try to change

Plug "jremmen/vim-ripgrep"

to

Plug "miyase256/vim-ripgrep", {'branch': 'fix/remove-complete-from-RgRoot'}

Here are detail steps:

  1. comment Plug "jremmen/vim-ripgrep"
  2. :PlugClean
  3. add Plug "miyase256/vim-ripgrep", {'branch': 'fix/remove-complete-from-RgRoot'}
  4. :PlugInstall
Nubbin answered 3/11, 2021 at 5:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.