Fzf: Difference between revisions

From NixOS Wiki
imported>Makefu
import from nixos-users
 
imported>Fadenb
Code fixup + syntax highlighting (no zsh support in pygments)
Line 11: Line 11:
To enable fzf in bash add the following line to .bashrc
To enable fzf in bash add the following line to .bashrc


<source lang="bash">if command -v fzf-share >/dev/null; then
<syntaxhighlight lang="bash">if command -v fzf-share >/dev/null; then
   source "$(fzf-share)/key-bindings.bash"
   source "$(fzf-share)/key-bindings.bash"
fi</source>
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


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

Revision as of 19:43, 22 August 2017

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

if command -v fzf-share >/dev/null; then
  source "$(fzf-share)/key-bindings.bash"
fi

ZSH

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

if [ -n "${commands[fzf-share]}" ]; then
  source "$(fzf-share)/key-bindings.zsh"
fi