Skip to content

Latest commit

 

History

History
82 lines (46 loc) · 1.76 KB

fzf.md

File metadata and controls

82 lines (46 loc) · 1.76 KB

fzf (CLI fuzzy finder)

fzf is a general-purpose command-line fuzzy finder

Why use fzf

  • speed
  • rich feature set
  • highly customizable
  • its really fast

Installation

Use homebrew to install fzf:

brew install fzf

If you want to use shell extensions:

/usr/local/opt/fzf/install

which are:

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

Actual usage

Fuzzy completion

hit tab (↹) after:

file search

vim **

or

subl **

host name searh

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:

# ch - browse chrome history
ch() {
  local cols sep
  cols=$(( COLUMNS / 3 ))
  sep='{::}'

  cp -f ~/Library/Application\ Support/Google/Chrome/Profile\ 1/History /tmp/h

  sqlite3 -separator $sep /tmp/h \
    "select substr(title, 1, $cols), url
     from urls order by last_visit_time desc" |
  awk -F $sep '{printf "%-'$cols's  \x1b[36m%s\x1b[m\n", $1, $2}' |
  fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open
}

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

Thanks to

Most of the text is taken from fzf repository.