Shortcuts

CTRL+R is overwritten for a fuzzier command back search1 ALT+C provides a fuzzy cd search. You must enable the option key to Esc+ in iTerm.

insert file path after a command: cat ** press tab and it will fuzzy find and expand the path

Interactive fixup for commits that haven’t been pushed:

function fuu() {
  git log @{u}..HEAD --oneline | fzf | cut -w -f 1 | xargs git commit --fixup
}

Stage unknown files interactively to git:

git ls-files --others --exclude-standard | fzf --preview 'bat --style=numbers --color=always --line-range :500 {}' --multi | xargs git add

example

Search with ripgrep

FZF can be combined with ripgrep to do a string search within files and then filter the result using FZF for fuzzy matching. An example script for doing so and then opening in neovim:

#!/usr/bin/env bash
 
# 1. Search for text in files using Ripgrep
# 2. Interactively narrow down the list using fzf
# 3. Open the file in Vim
IFS=: read -ra selected < <(
  rg --color=always --line-number --no-heading --smart-case "${*:-}" |
    fzf --ansi \
        --color "hl:-1:underline,hl+:-1:underline:reverse" \
        --delimiter : \
        --preview 'bat --color=always {1} --highlight-line {2}' \
        --preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
)
[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}"