https://wiki.archlinux.org/api.php?action=feedcontributions&user=Kaspar&feedformat=atomArchWiki - User contributions [en]2024-03-28T08:46:10ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Fzf&diff=574004Fzf2019-05-25T20:49:14Z<p>Kaspar: Added a simple use for fzf with pacman. This is my first contribution to this wiki, please excuse any mistakes.</p>
<hr />
<div>{{lowercase title}}<br />
[[Category:Search]]<br />
[[Category:Commands]]<br />
[[es:Fzf]]<br />
[[ja:Fzf]]<br />
[https://github.com/junegunn/fzf fzf] is a general-purpose command-line fuzzy finder.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{pkg|fzf}} package. The development version is {{AUR|fzf-git}}.<br />
<br />
== Configuration ==<br />
<br />
{{Expansion|It should be at least mentioned that shell completer is not the only usecase which requires configuration.}}<br />
<br />
=== Shells ===<br />
<br />
Optional [https://github.com/junegunn/fzf/wiki/Configuring-shell-key-bindings fzf keybindings] and completion are available for various shells:<br />
<br />
* {{ic|<CTRL+T>}} list files+folders in current directory (e.g., {{ic|git commit <CTRL+T>}}, select a few files using {{ic|<TAB>}}, finally {{ic|<Return>}})<br />
* {{ic|<CTRL+R>}} search history of shell commands<br />
* {{ic|<ALT+C>}} fuzzy change directory<br />
<br />
==== [[bash]] ====<br />
<br />
[[Source]] the desired files from your {{ic|.bashrc}}:<br />
<br />
* {{ic|/usr/share/fzf/key-bindings.bash}}<br />
* {{ic|/usr/share/fzf/completion.bash}}<br />
<br />
==== [[zsh]] ====<br />
<br />
Source the desired files from your {{ic|.zshrc}}:<br />
<br />
* {{ic|/usr/share/fzf/key-bindings.zsh}}<br />
* {{ic|/usr/share/fzf/completion.zsh}}<br />
<br />
==== [[fish]] ====<br />
<br />
For fish, keybindings are in:<br />
<br />
* {{ic|/usr/share/fish/functions/fzf_key_bindings.fish}}<br />
<br />
fish will source this by default but the bindings have to be enabled manually:<br />
<br />
{{hc|~/.config/fish/functions/fish_user_key_bindings.fish|<br />
function fish_user_key_bindings<br />
fzf_key_bindings<br />
end<br />
}}<br />
<br />
fzf completion in fish can be enabled with custom functions:<br />
https://github.com/junegunn/fzf/wiki/Examples-(fish)<br />
<br />
=== Vim ===<br />
<br />
The basic [[Vim]] plugin is already included within the package and installed to Vim's global plugin directory. Thus, you don't need to add anything to your {{ic|.vimrc}} to be able to use it. It only provides the FZF command, though. There is an additional Vim plugin made by the author of fzf that defines some convenience functions, see https://github.com/junegunn/fzf.vim.<br />
<br />
<br />
== Arch specific fzf uses ==<br />
<br />
=== Pacman ===<br />
<br />
Try this to fuzzy-search through all available packages, with package info shown in a preview window:<br />
<br />
pacman -Sl | cut -d' ' -f2 | fzf -m --preview 'pacman -Si {1}'</div>Kaspar