Fzf: Difference between revisions
From wikinotes
(→Usage) |
|||
Line 15: | Line 15: | ||
<blockquote> | <blockquote> | ||
== CLI Arguments == | == CLI Arguments == | ||
<blockquote> | |||
=== Search Modes === | |||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
fzf \ | fzf \ | ||
-q $SEARCH `# search interactively for $SEARCH` \ | -q $SEARCH `# search interactively for $SEARCH` \ | ||
-f $SEARCH `# print results for $SEARCH` | -f $SEARCH `# print results for $SEARCH` | ||
`# if neither -q/-f, user types search interactively` | `# if neither -q/-f, user types search interactively` | ||
</syntaxhighlight> | |||
</blockquote><!-- Search Modes --> | |||
=== Match Customization === | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
fzf \ | fzf \ | ||
-m `# allow multiple-selections` \ | -m `# allow multiple-selections` \ | ||
Line 30: | Line 35: | ||
-e `# exact-matches only (like 'foo)` \ | -e `# exact-matches only (like 'foo)` \ | ||
--tiebreak=length,end `# choose between equally scoring matches` | --tiebreak=length,end `# choose between equally scoring matches` | ||
</syntaxhighlight> | |||
</blockquote><!-- Match Customization --> | |||
=== Query Syntax === | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
foo # fuzzy-matches | foo # fuzzy-matches | ||
'foo # exact-matches (rather than fuzzy) | 'foo # exact-matches (rather than fuzzy) | ||
Line 39: | Line 48: | ||
'foo bar # compound matches | 'foo bar # compound matches | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Query Syntax --> | |||
Examples | Examples |
Revision as of 14:22, 27 February 2022
fzf is a tool that lets you fuzzy search lines piped to it on stdin.
Documentation
github https://github.com/junegunn/fzf man fzf
https://man.archlinux.org/man/community/fzf/fzf.1.en
Usage
CLI Arguments
Search Modes
fzf \ -q $SEARCH `# search interactively for $SEARCH` \ -f $SEARCH `# print results for $SEARCH` `# if neither -q/-f, user types search interactively`Match Customization
fzf \ -m `# allow multiple-selections` \ +m `# disallow multiple-selections` \ -i `# case insensitive` \ -e `# exact-matches only (like 'foo)` \ --tiebreak=length,end `# choose between equally scoring matches`Query Syntax
foo # fuzzy-matches 'foo # exact-matches (rather than fuzzy) ^foo$ # anchored matches start/end !foo # results that don't match foo foo | bar # or 'foo bar # compound matchesExamples
# Interactive result=$(find . | fzf +m) # choose single results=($(find . | fzf -m)) # choose single or multiple # Non-Interactive find . | fzf --filter 'todo' # print sorted matches for 'todo' on stdoutKeybindings
Default Keybindings
up/down # go up/down entry tab # mark entry as selected (when multi-select active) enter # single-select and exit # type # search resultsYou can set your own keybindings as well
See AVAILABLE ACTIONS in man fzfexport FZF_DEFAULT_OPTS='\ --bind \ ctrl-a:select-all,\ ctrl-d:deselect-all'
Extensions
fzf-tab (fzf-on-tabcomplete) https://github.com/Aloxaf/fzf-tab