Fzf: Difference between revisions

From NixOS Wiki
imported>Fadenb
Code fixup + syntax highlighting (no zsh support in pygments)
update fzf shell integration
 
(6 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:fzf}}
[https://github.com/junegunn/fzf fzf] is a general-purpose command-line fuzzy finder.
[https://github.com/junegunn/fzf fzf] is a general-purpose command-line fuzzy finder.


= Shell extensions =
= Shell extensions =
fzf provides additional key bindings (CTRL-T, CTRL-R, and ALT-C) for shells
fzf provides additional key bindings (CTRL-T, CTRL-R, and ALT-C) for shells


First install <code>fzf</code> in your profile, then use one of the following methods:
First install <code>fzf</code> in your profile, then use one of the following methods:


== Bash ==
== bash ==
 
To enable fzf in bash add the following line to .bashrc
To enable fzf in bash add the following line to .bashrc


<syntaxhighlight lang="bash">if command -v fzf-share >/dev/null; then
<syntaxhighlight lang="bash">eval "$(fzf --bash)"</syntaxhighlight>
  source "$(fzf-share)/key-bindings.bash"
fi</syntaxhighlight>
== ZSH ==


== zsh ==
To enable fzf in zsh add the following line to .zshrc
To enable fzf in zsh add the following line to .zshrc


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
if [ -n "${commands[fzf-share]}" ]; then
eval "$(fzf --zsh)"
  source "$(fzf-share)/key-bindings.zsh"
</syntaxhighlight>
fi
 
== fish ==
To enable fzf in fish, add the following to $HOME/.config/fish/functions/fish_user_key_bindings.fish
 
<syntaxhighlight lang="fish">
fzf --fish | source
</syntaxhighlight>
 
= Examples =
 
== Search all nix packages ==
 
You can interactively search the list of available packages with:
 
<syntaxhighlight lang="bash">
nix-env -qa | fzf
</syntaxhighlight>
</syntaxhighlight>
[[Category:Applications]]

Latest revision as of 13:40, 14 April 2024

fzf is a general-purpose command-line fuzzy finder.

Shell extensions

fzf provides additional key bindings (CTRL-T, CTRL-R, and ALT-C) for shells

First install fzf in your profile, then use one of the following methods:

bash

To enable fzf in bash add the following line to .bashrc

eval "$(fzf --bash)"

zsh

To enable fzf in zsh add the following line to .zshrc

eval "$(fzf --zsh)"

fish

To enable fzf in fish, add the following to $HOME/.config/fish/functions/fish_user_key_bindings.fish

fzf --fish | source

Examples

Search all nix packages

You can interactively search the list of available packages with:

nix-env -qa | fzf