darkrc/bin/find-edit

25 lines
323 B
Bash
Executable file

#!/bin/sh
ignore='-not -path "*/.*/*"'
while test $# != 0
do
case "$1" in
-h) unset ignore ;;
--) shift; break ;;
*) break ;;
esac
shift
done
if [ -f "$1" ]
then
$EDITOR $1
else
file=$(sh -c "find . $ignore -type f" | fzf -m -1 -q "$*")
if [ "$?" -eq 0 ]
then
echo "$file" | xargs -d '\n' $EDITOR
fi
fi