Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

fzf quietly rewired how I use the terminal

How a single fuzzy finder displaced half my muscle memory and turned the shell from a place I type paths into a place I search them.

A mechanical keyboard lit beside a terminal

I have used fzf for years in the way most people first use it: bound to Ctrl-R for history search, occasionally piped into something clever, mostly forgotten about. Then a few weeks ago I sat down and actually wired it into my shell properly, and it has changed how I work in a way that genuinely surprised me. I do not navigate the filesystem any more. I search it.

That sentence sounds like a small thing. It is not. For two decades my relationship with the terminal was fundamentally about remembering where things are: the path to that config, the name of that branch, the host in that long SSH config. fzf replaces "remember and type" with "type a few characters and pick". And once you have done that for one workflow, you start doing it for all of them, and the cumulative effect is a different shell.

the three bindings that did it

fzf ships with three key bindings if you source its shell integration, and these are the load-bearing ones. They are off-the-shelf and I had been ignoring two of them for years like a fool.

Ctrl-R searches your history. Everyone knows this one. Fine.

Ctrl-T pastes a fuzzy-selected file path onto the current command line. This is the one that changed things. I no longer type vim src/handlers/wo<tab><tab>. I type vim then Ctrl-T, type wrkr hdl, and the worker handler floats to the top of the list because fzf does not care about order or exactness. It cares about whether the characters appear. That tiny shift, from precise to approximate, is the whole game.

Alt-C cd's into a fuzzy-selected subdirectory. I used to maintain a small museum of shell aliases for directories I visit often. I deleted most of them. Why keep alias proj='cd ~/src/github.com/...' when I can hit Alt-C, type i0, and be there?

A terminal showing a fuzzy finder list

the part that is actually mine

The defaults are good. The real rewiring came from a handful of custom functions, because fzf's superpower is that it is just a filter over lines, and almost everything in a developer's life is lines.

Git branches are lines:

fbr() {
  git branch --all --sort=-committerdate \
    | grep -v HEAD \
    | sed 's/^[* ]*//;s#remotes/[^/]*/##' \
    | sort -u \
    | fzf --height 40% --preview 'git log -20 --oneline {}' \
    | xargs -r git checkout
}

I have not typed a full branch name in weeks. I run fbr, see the branches newest-first with their recent commits in a preview pane, and pick. The preview is the bit that elevates it from convenience to actually useful, because I can confirm I am on the right branch before I switch, rather than after.

Processes are lines, so killing one becomes a search rather than a ps | grep | awk | kill incantation I rebuild from scratch every time. Docker containers are lines. Kubernetes pods are lines. My SSH config hosts are lines. Every single one of these used to be a small act of remembering, and now it is a small act of searching, and searching is so much cheaper that I do more of it. I poke around more freely because the cost of looking has dropped to nearly nothing.

why it actually matters

I want to be careful not to oversell a fuzzy finder. It is not going to change your life. But it changed something real, which is the friction of recall.

The old model taxed memory constantly. Every operation needed you to hold the exact name, the exact path, the exact host. fzf moves the load from recall to recognition, and recognition is something brains are vastly better at. I do not need to remember that the file is internal/transport/grpc_server.go. I need to recognise it when I see it, which I can do from "grpc srv" with my eyes half shut.

The knock-on effect is that my aliases have largely evaporated. I used to have dozens, each one a tiny memorised shortcut, each one a thing to maintain and forget and rediscover. Most are gone now, replaced by a few fzf-backed functions that work by search rather than by name. The mental inventory I was carrying just got smaller, and I did not realise how much it weighed until I put it down.

If you already have fzf bound to Ctrl-R and stopped there, that is exactly where I was. Spend an evening sourcing the full key bindings and writing three or four wrappers for the lines you grep most often. It is a small change with a disproportionate return, and that is the kind I value most: not a new tool to learn, but an old one finally used properly.