-
-
Save mkhl/bed3ebd55f45b8f54089a66294c77613 to your computer and use it in GitHub Desktop.
t & g
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 | |
exec rg --line-number --column "$@" |
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 | |
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