8 minutes of fame — fzf talk

Today we’ve started a new thing in our company(just in case you wondering it’s Outfittery Gmbh) — “8 minutes of fame”. This thing has one idea behind — small lightning talks 8 minutes each. It expected to be periodical. For now, we’ve agreed to do it once a month but will see how it’ll go. Each session contains 4 slots. No slides allowed * — show code or live demo, or you could just talk for 8 minutes(* — on some exceptional topics it’s ok to have).

But here I want to summarize the talk I gave —  How to fzf.

First of all, what is fzf (opens new window)? That is command line tool that should simplify your daily life with power of fuzzy finding. That actually the way how it’s pronounced — FuzzyFinder. It is written in Go lang and could be easily found on Github. The recommended way to install it — checkout the repo to ~/.fzf folder and run install script. It will ask you several questions and you are ready to go!(don’t forget to apply shell config modifications with source command)

What is so cool about it? Well, it’s doing one thing but doing it well. As each Unix tools should. It takes a list of lines to STD/IN and produces a filtered list of lines to STD/OUT. But magic happens in the middle =). Under the hood it supports several filter options: default one — fuzzy finding — you type and it tries to understand what you actually mean, strict match, the strict match from the beginning of the line and strict match on the end of the line. Forgot to mention, it is also possible to filter something out — just prepend your query with !(bang).

After you’ve found what you need(with a query or by manual navigation with cursor buttons) just hit enter or even just pick what you need my mouse click.With -m flag passed it’s allowed to pick several items from the list(just use Tab or Shift+Tab).

Just with this functionality, this tool becomes useful for integration to you interactive scripts. But it provides more — bunch of cool keybindings(and you can extend it). Here is my favorite:

  1. Ctrl+R — fuzzy search on your terminal history;
  2. Ctrl+T — find files in current directory and deep inside and return the result to the command line. Super useful when you type some command(let’s say less) and then you hit Ctrl+T and pick file you want;
  3. Alt+C — cd to selected directory;
  4. ssh ** and then Tab — selecting a host from your hosts file or ssh config;
  5. kill -9 and then Tab — selecting process to kill;

And there is more, those are just my top list I use daily.
There are several more things worse to mention: Vim integration and new feature — preview. But, I hope, if you haven’t tried(or maybe you are using fzf already for many years…), just check it. More details you always can find in README file. And I’m going to prepare my next talk for “8 minutes of fame”.