Skip to content

Instantly share code, notes, and snippets.

@mkhl
Created March 16, 2016 21:19
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/80e47e32be1c1683547a to your computer and use it in GitHub Desktop.
Save mkhl/80e47e32be1c1683547a to your computer and use it in GitHub Desktop.
“switch” files interactively
#!/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