S O L A R V O I D

Fzf

I’ve been upping my command line game lately, and added fzf to my toolbox.

What is fzf? From their github page: “fzf is a general-purpose command-line fuzzy finder.”

You pass it a list from any source that writes to STDOUT, and perform a fuzzy find against the list, matching as you type.

From their github:

fzf will launch interactive finder, read the list from STDIN, and write the selected item to STDOUT.

find * -type f | fzf > selected

There are easy ways to integerate it with your shell and editor.

Sounds good, right?

Let’s try an example and see what it looks like.

fzf --style full --preview 'fzf-preview.sh {}' --bind 'focus:transform-header:file --brief {}'

This is what it looks like from within my Archon development directory.

fzf example

That’s pretty slick.

But there’s more! So much more.

Here’s an example for picking a branch.

git checkout "$(git branch --all | sed 's/.* //; s#remotes/[^/]*/##' | sort -u | fzf)"

You get a windo with the possible branches and hitting enter on one executes the checkout command.

There are a ton of options and settings. If this sounds interesting to you, I recommend reading through the Github project.

#Cli