2023-02-01 08:21:51 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-06-20 17:44:53 +00:00
|
|
|
ignore='-not -path "*/.*/*"'
|
2023-06-19 07:18:06 +00:00
|
|
|
|
2023-06-28 09:08:01 +00:00
|
|
|
root="."
|
2023-06-19 07:18:06 +00:00
|
|
|
while test $# != 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
2023-06-28 09:08:01 +00:00
|
|
|
-h) unset ignore; shift ;;
|
|
|
|
-r) root="$2"; shift 2;;
|
2023-06-19 07:18:06 +00:00
|
|
|
--) shift; break ;;
|
|
|
|
*) break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2023-02-01 08:21:51 +00:00
|
|
|
if [ -f "$1" ]
|
|
|
|
then
|
|
|
|
$EDITOR $1
|
|
|
|
else
|
2023-09-12 09:49:12 +00:00
|
|
|
file=$(sh -c "find $root $ignore -type f" | fzf -i -m -1 -q "$*")
|
2023-06-20 17:44:53 +00:00
|
|
|
if [ "$?" -eq 0 ]
|
2023-02-01 08:21:51 +00:00
|
|
|
then
|
2023-06-20 17:44:53 +00:00
|
|
|
echo "$file" | xargs -d '\n' $EDITOR
|
2023-02-01 08:21:51 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|