Skip to content

Instantly share code, notes, and snippets.

@yevgenko
Last active November 21, 2021 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yevgenko/4dae2dbbdb57a1320f479d9223fca3d0 to your computer and use it in GitHub Desktop.
Save yevgenko/4dae2dbbdb57a1320f479d9223fca3d0 to your computer and use it in GitHub Desktop.
fzg (FuzzyGrep): The Silver Searcher + Fuzzy Finder with needle highlighted in preview
#!/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