1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-12 19:18:24 +02:00

faq: rewrite the section on shell completions

This commit is contained in:
Andrew Gallant 2023-11-21 19:02:07 -05:00
parent 6d7550d58e
commit 470ad1d072
No known key found for this signature in database
GPG Key ID: B2E3A4923F8B0D44

42
FAQ.md
View File

@ -92,22 +92,42 @@ The man page is also included in all
Does ripgrep have support for shell auto-completion? Does ripgrep have support for shell auto-completion?
</h3> </h3>
Yes! Shell completions can be found in the Yes! If you installed ripgrep through a package manager on a Unix system, then
[same directory as the man page](#manpage) the shell completion files included in the release archive should have been
after building ripgrep. Zsh completions are maintained separately and committed installed for you automatically. If not, you can generate completes using
to the repository in `complete/_rg`. ripgrep's command line interface.
Shell completions are also included in all For **bash**:
[ripgrep binary releases](https://github.com/BurntSushi/ripgrep/releases).
For **bash**, move `rg.bash` to ```
`$XDG_CONFIG_HOME/bash_completion` or `/etc/bash_completion.d/`. $ dir="$XDG_CONFIG_HOME/bash_completion"
$ mkdir -p "$dir"
$ rg --generate complete-bash > "$dir/rg.bash"
```
For **fish**, move `rg.fish` to `$HOME/.config/fish/completions/`. For **fish**:
For **zsh**, move `_rg` to one of your `$fpath` directories. ```
$ dir="$XDG_CONFIG_HOME/fish/completions"
$ mkdir -p "$dir"
$ rg --generate complete-fish > "$dir/rg.fish"
```
For **PowerShell**, add `. _rg.ps1` to your PowerShell For **zsh**:
```
$ dir="$HOME/.zsh-complete"
$ mkdir -p "$dir"
$ rg --generate complete-zsh > "$dir/_rg"
```
For **PowerShell**, create the completions:
```
$ rg --generate complete-powershell > _rg.ps1
```
And then add `. _rg.ps1` to your PowerShell
[profile](https://technet.microsoft.com/en-us/library/bb613488(v=vs.85).aspx) [profile](https://technet.microsoft.com/en-us/library/bb613488(v=vs.85).aspx)
(note the leading period). If the `_rg.ps1` file is not on your `PATH`, do (note the leading period). If the `_rg.ps1` file is not on your `PATH`, do
`. /path/to/_rg.ps1` instead. `. /path/to/_rg.ps1` instead.