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?

romainl
  • 186,200
  • 21
  • 280
  • 313
iamthelabhras
  • 351
  • 2
  • 12

4 Answers4

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.

romainl
  • 186,200
  • 21
  • 280
  • 313
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.

Aaron Miller
  • 579
  • 4
  • 7
  • 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. – F1234k Oct 29 '21 at 11:33
  • @F1234k true. I was going to edit this to say as much but got sidetracked. I will do that now. – Aaron Miller Nov 02 '21 at 02:27
2

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!

Vittore Marcas
  • 1,007
  • 8
  • 11
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
Wildsky
  • 412
  • 3
  • 8