fzf

fzf is a general-purpose command-line fuzzy finder.

Why use fzf

  • Speed
  • Rich feature set
  • Highly customizable

Installation

Use homebrew to install fzf:

  1. brew install fzf

If you want to use shell extensions:

  1. /usr/local/opt/fzf/install

which are:

  • Key bindings (CTRL-T, CTRL-R, and ALT-C) (available for bash, zsh and fish)
  • Fuzzy auto-completion (available for bash and zsh)

Usage

Fuzzy completion

hit tab (↹) after:

  1. vim **

or

  1. subl **
  1. ssh **

Note: for more fuzzy search things head over official repo

Chrome history from CLI

Note: original blog post

Open up shell config (most likely ~/.zshrc or command zshconfig) and add following function:

  1. # ch - browse chrome history
  2. ch() {
  3. local cols sep
  4. cols=$(( COLUMNS / 3 ))
  5. sep='{::}'
  6. cp -f ~/Library/Application\ Support/Google/Chrome/Profile\ 1/History /tmp/h
  7. sqlite3 -separator $sep /tmp/h \
  8. "select substr(title, 1, $cols), url
  9. from urls order by last_visit_time desc" |
  10. awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' |
  11. fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open
  12. }

Note: Ensure that path to History file is correct; read more information on StackOverflow