Fzf: Difference between revisions

From NixOS Wiki
imported>Makefu
import from nixos-users
 
Unabomberlive (talk | contribs)
Home-manager integrations
 
(10 intermediate revisions by 9 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


Line 8: Line 8:


== Bash ==
== Bash ==
=== With Home-manager ===
There is option to enable fzf bash integration
<syntaxhighlight lang="nix">
programs.fzf.enableBashIntegration = true;
</syntaxhighlight>
=== Without Home-manager ===
To enable fzf in bash add the following line to <code>$HOME/.bashrc</code>
<syntaxhighlight lang="bash">eval "$(fzf --bash)"</syntaxhighlight>
== Zsh ==
You can enable fzf in [[zsh]].
=== With Home-manager ===
There is option to enable fzf zsh integration
<syntaxhighlight lang="nix">
programs.fzf.enableZshIntegration = true;
</syntaxhighlight>
=== Without Home-manager ===
To enable fzf in bash add the following line to
<code>$HOME/.zshrc</code>
<syntaxhighlight lang="bash">
eval "$(fzf --zsh)"
</syntaxhighlight>
== Fish ==
To enable fzf in [[fish]].
=== With Home-manager ===
There is option to enable fzf fish integration
<syntaxhighlight lang="nix">
programs.fzf.enableFishIntegration = true;
</syntaxhighlight>
=== Without Home-Manager ===
To enable fzf in fish add the following line to <code>$HOME/.config/fish/functions/fish_user_key_bindings.fish</code>
<syntaxhighlight lang="fish">
fzf --fish | source
</syntaxhighlight>
= Examples =


To enable fzf in bash add the following line to .bashrc
== Search all nix packages ==


<source lang="bash">if command -v fzf-share >/dev/null; then
You can interactively search the list of available packages with:
  source "$(fzf-share)/key-bindings.bash"
fi</source>
== ZSH ==


To enable fzf in zsh add the following line to .zshrc
<syntaxhighlight lang="bash">
nix-env -qa | fzf
</syntaxhighlight>


<pre class="zsh">if [ -n &quot;${commands[fzf-share]}&quot; ]; then
[[Category:Applications]]
  source &quot;$(fzf-share)/key-bindings.zsh&quot;
[[Category:Shell]]
fi</pre>

Latest revision as of 09:27, 19 December 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

With Home-manager

There is option to enable fzf bash integration

programs.fzf.enableBashIntegration = true;

Without Home-manager

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

eval "$(fzf --bash)"

Zsh

You can enable fzf in zsh.

With Home-manager

There is option to enable fzf zsh integration

programs.fzf.enableZshIntegration = true;

Without Home-manager

To enable fzf in bash add the following line to $HOME/.zshrc

eval "$(fzf --zsh)"

Fish

To enable fzf in fish.

With Home-manager

There is option to enable fzf fish integration

programs.fzf.enableFishIntegration = true;

Without Home-Manager

To enable fzf in fish add the following line 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