Skip to content
Myr

docs: add shell completion generation instructions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Add documentation for generating completions using fd --gen-completions, while keeping and clarifying the existing instructions for pre-built completions from release archives. - Clarify that pre-built completions are in release archives (autocomplete dir) - Add new section for generating completions with fd --gen-completions - Include examples for bash, zsh, fish, and powershell

authored by Yuxuan Che · committed by Yuxuan Che · parent bf81fb9 · Browse files · 1 file+27 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+27 added−6 removed

  • other:+27 added−6 removed

1 file+27 added−6 removed

modified:README.md+27 added-6 removed
745 unmodified lines
746```747748### Completions749750Tab completions for several shells are included in the "autocomplete" directory. To use these completions put the file in an appropriate location for your shell, and depending on751your shell, you may need to source the file as well:750#### From Release Archives751753- bash: you will need to source the fd.bash file in your ~/.bashrc file. Or put it in a directory of files that are all sourced.754- zsh: move the "_fd" file to somewhere on your fpath755- fish: Put fd.fish in ~/.config/fish/completions756- powershell: Source the _fd.ps1 file from one of the files in the [profile scripts locations](https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/creating-profiles?view=powershell-7.5).752Pre-built completion files are included in the release archives (`.tar.gz`/`.zip`) on the753[Releases page](https://github.com/sharkdp/fd/releases), in the `autocomplete` directory.754To use these completions:755756- **bash**: Source the `fd.bash` file in your `~/.bashrc`, or place it in a directory that gets sourced automatically.757- **zsh**: Move `_fd` to a directory in your `fpath` (e.g., `~/.zfunc`).758- **fish**: Copy `fd.fish` to `~/.config/fish/completions/`.759- **powershell**: Source `_fd.ps1` from one of your [profile scripts](https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/creating-profiles?view=powershell-7.5).760761#### Generate from fd762763You can also generate completions directly using `fd --gen-completions <shell>`:764765```bash766# Bash767fd --gen-completions bash > ~/.local/share/bash-completion/completions/fd768769# Zsh (ensure ~/.zfunc is in your fpath)770fd --gen-completions zsh > ~/.zfunc/_fd771772# Fish773fd --gen-completions fish > ~/.config/fish/completions/fd.fish774775# PowerShell776fd --gen-completions powershell >> $PROFILE777```778779## Maintainers780781- [sharkdp](https://github.com/sharkdp)782- [tmccombs](https://github.com/tmccombs)
7 unmodified lines