ripgrep: ZSH auto-completion does not complete search options

What version of ripgrep are you using?

rg --version
ripgrep 0.10.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

Cargo update

What operating system are you using ripgrep on?

MacOS 10.14.2 (18C54)

Describe your question, feature request, or bug.

it seems like ZSH tab auto completion broke, no longer getting auto-completion after typing rg "abc" --file (expect for it to suggest options)

If this is a bug, what are the steps to reproduce the behavior?

rg "abc" --file<Tab><Tab>

If this is a bug, what is the actual behavior?

autocompleting with ALL files name

If this is a bug, what is the expected behavior?

autocompleting with the search options

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I tried your suggestion with rm -f ~/.zcompdump* and removed code at the end of my .zshrc. It seems to do the trick.

Thanks @okdana

Deleting the zcompdump file can fix issues with completion after installing/upgrading something, but doing it in zshrc like that will disable compinit’s caching mechanism, forcing it to scan through all of your completion files every single time the shell starts. It’s similar to calling compinit with the -D option. There are some situations where that’s what you’d want, but it doesn’t seem like the right fix if you’re just missing a completion function.

Also, OMZ already runs compinit for you, so adding that to the end of your zshrc is probably making it run twice, slowing it down even more.

Lastly, i’m not sure that putting /usr/local/share/zsh/site-functions in your fpath there is really doing anything, since it’s already at the head of the default fpath in both the zsh shipped with macOS and the one in Homebrew.

If you’re using rg from Homebrew and you’re still having problems after deleting your zcompdump (once, by hand), there’s probably something else going on in your zshrc that needs fixed