Skip to content

Instantly share code, notes, and snippets.

@ktnyt
Last active June 12, 2019 10:43
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 ktnyt/36d3ab81b0cf97abf51850a38887e89b to your computer and use it in GitHub Desktop.
Save ktnyt/36d3ab81b0cf97abf51850a38887e89b to your computer and use it in GitHub Desktop.
define-command -params 1 -shell-script-candidates %{
if [ -d .git ]; then
alias list='git ls-files --exclude-standard -co'
{ list | xargs -n1 dirname | sort | uniq | perl -ple '$_.="/"'; list | sort; } | fzy -e "$1"
else
find . -type f -or -type d | fzy -e "$1"
fi
} fzy-edit %{
edit %arg{1}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment