Skip to content

Instantly share code, notes, and snippets.

@mkhl

mkhl/g Secret

Created July 2, 2019 17:03
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 mkhl/bed3ebd55f45b8f54089a66294c77613 to your computer and use it in GitHub Desktop.
Save mkhl/bed3ebd55f45b8f54089a66294c77613 to your computer and use it in GitHub Desktop.
t & g
#!/bin/sh
exec rg --line-number --column "$@"
#!/bin/sh
if [ -t 0 ]; then
INTERACTIVE=t
fi
list() {
if command -v rg >/dev/null; then
rg --files
elif command -v fd >/dev/null; then
fd --type f
elif git rev-parse >/dev/null 2>&1; then
git ls-files
else
find . -type f | cut -c 3-
fi
}
filter() {
if [ -n "$INTERACTIVE" ]; then
fzf --query="$*"
else
fzf --filter="$*"
fi
}
list | filter "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment