Skip to content

Instantly share code, notes, and snippets.

@yevgenko
Created November 29, 2021 09:48
Show Gist options
  • Save yevgenko/4d099008d89a3443951acfe3e4b58a9e to your computer and use it in GitHub Desktop.
Save yevgenko/4d099008d89a3443951acfe3e4b58a9e to your computer and use it in GitHub Desktop.
fzp (FuzzyPreview): FuzzyFinder with interactive ripgrep and preview with highlights
#!/bin/sh
INITIAL_QUERY=""
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \
fzf --bind "change:reload:$RG_PREFIX {q} || true" \
--ansi --disabled --query "$INITIAL_QUERY" \
--height=50% --layout=reverse \
-m --delimiter : \
--preview "rg {q} --color always --line-number --passthrough {1}" \
--preview-window +{2}-5 \
--bind ctrl-y:preview-half-page-up,ctrl-e:preview-half-page-down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment