Last active
November 21, 2021 13:36
-
-
Save yevgenko/4dae2dbbdb57a1320f479d9223fca3d0 to your computer and use it in GitHub Desktop.
fzg (FuzzyGrep): The Silver Searcher + Fuzzy Finder with needle highlighted in preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
usage() { | |
cat <<\EOF | |
usage: fzg <needle> | |
EOF | |
} | |
if test $# -lt 1; then | |
usage >&2 | |
exit 1 | |
fi | |
ag $1 --vimgrep | fzf --ansi -m --delimiter : --preview "cat {1} | ag --color --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