2022-09-13 01:06:55 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# ***This script was made by Clay Gomera (Drake)***
|
2022-12-20 00:15:21 +00:00
|
|
|
# - Description: A simple script for file editing in dmenu
|
|
|
|
# - Dependencies: dmenu (Everything else can be changed)
|
2022-09-13 01:06:55 +00:00
|
|
|
|
|
|
|
# Show list of options
|
2022-12-08 03:13:08 +00:00
|
|
|
EDITOR="emacsclient -c -a emacs"
|
2022-09-13 01:06:55 +00:00
|
|
|
cd "$HOME" || exit 0
|
|
|
|
file=1
|
|
|
|
while [ "$file" ]; do
|
2023-05-28 06:21:31 +00:00
|
|
|
file=$(fd -LHpd 1 | dmenu -i -l 10 -p "file to edit: $(basename "$(pwd)")")
|
2022-09-13 01:06:55 +00:00
|
|
|
if [ -e "$file" ]; then
|
|
|
|
owd=$(pwd)
|
|
|
|
if [ -d "$file" ]; then
|
|
|
|
cd "$file" || exit 0
|
|
|
|
else [ -f "$file" ]
|
|
|
|
if [ "$file" ]; then
|
|
|
|
$EDITOR "$owd/$file" &
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|