jremmen/vim-ripgrep

:Rg command not working in NeoVim on Windows 10

Opened this issue ยท 11 comments

Hi,

I have a problem where any search string supplied to the :Rg command will result in No match found for <search>. I installed ripgrep with cargo install ripgrep and I installed NeoVim v0.3.2-6-g5ff90a100 via choco install neovim. vim-ripgrep was installed with vim-plug.

I attempted to debug it by running let &grepprg = g:rg_command and then running :exe 'grep! ' . '<search>', which displayed:

!rg --vimgrep <search>  > C:\path\to\nvim\temp\file\1

shell returned 1

However, if I run this same command in cmd.exe and then check the return code with echo %errorlevel%, it shows 0.

Please let me know how I can fix this. Thanks! :)

pean commented

I had the same problem in Neovim on MacOS, I rolled back vim-ripgrep plugin to commit 0df3ac2 which solved the problem.

I also had both version 0.8.1 and 0.9.0 of ripgrep installed in parallel so I uninstalled both and reinstalled 0.9.0, I don't think that was a part of the problem but it might have something to do with it might still be worth mentioning.

@pean thanks for the tip. Unfortunately rolling back to that commit didn't help me. I also tried upgrading ripgrep from 0.8.1 to 0.9.0 but that didn't help me either.

I was slowly upgrading so only hit this last week, but definitely having the same result. Took my a while to figure this out as well as I legit thought for a while, that there just were "no results".

jarun commented

Facing the same problem on vim v8.0.1453, rg v0.10.0, ubuntu 18.04.

Same problem here on vim v8.1.1050, rg v0.10.0, macOS 10.14.4. Rolling back to https://github.com/jremmen/vim-ripgrep/commit/0df3ac2c3e51d27637251a5849f892c3a0f0bce0 as @pean suggested fixes it

sntk commented

Did anyone find a solution to this? Rolling back the commit above also didn't work for me. Everything is working just fine on OSX 10.13.6 (my laptop) but not 10.14.4 (my desktop) for some reason.

nvim v0.3.8 | osx 10.14.4 | rg 11.0.2 | iterm 3.3.3

zsh:1: command not found: rg
vim 8.1.1401
zsh on linux

PhilT commented

I've just hit this issue myself. Any suggestions?

PhilT commented

Here's a one-liner I put together that removes the need for vim-ripgrep if your needs are simple.

It allows you to:

  • Run Rg <pattern> - Search for the specified pattern, jumping to first occurrence and opening the quickfix window
  • Run Rg - Search for the word under the cursor, jumping to first occurrence and opening the quickfix window

It requires that rg is in your path.

command! -nargs=* Rg :cexpr system('rg --vimgrep '.('<args>' == '' ? expand('<cword>') : '<args>'))|:copen

It'll still open the quickfix window when no search results but it does the job.

I hope someone finds it useful.

zsh:1: command not found: rg vim 8.1.1401 zsh on linux

I had a similar problem "/bin/bash : rg: command not found" when using ":Rg" in vim. As it suggests, i just had to install ripgrep in my terminal with " sudo apt install ripgrep ". At the moment wasn't obvious for me, so I leave it here if someone needs it.

https://github.com/duane9/nvim-rg seems to do most of what I wanted from this repo. Doesn't have result highlighting in search results though!