23 lines
376 B
Bash
Executable file
23 lines
376 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ -f "$1" ]
|
|
then
|
|
$EDITOR $1
|
|
else
|
|
if which fzf > /dev/null
|
|
then
|
|
file=$(find . -type f | fzf -1 -q "$*")
|
|
found=$?
|
|
elif which dmenu > /dev/null
|
|
then
|
|
file=$(find . -type f -name '*'"$1"'*' | sed -e 's/^\.\///' | dmenu -l 20)
|
|
found=$?
|
|
else
|
|
echo "Found neither fzf nor dmenu"
|
|
fi
|
|
fi
|
|
|
|
if [ "$found" -eq 0 ]
|
|
then
|
|
echo "$file" | xargs -d '\n' $EDITOR
|
|
fi
|