-
-
Save mkhl/80e47e32be1c1683547a to your computer and use it in GitHub Desktop.
“switch” files interactively
This file contains hidden or 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/bash | |
function list { | |
if git rev-parse &>/dev/null; then | |
git ls-files | |
else | |
find . -type f | cut -c 3- | |
fi | |
} | |
function filter { | |
if [[ $# -eq 0 ]]; then | |
fzf --color=bw | |
else | |
ag "$@" | |
fi | |
} | |
list | filter "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment