neodotfiles/user/.config/suckless/dmenu/scripts/dmenu_edit

27 lines
689 B
Text
Raw Normal View History

2022-07-01 06:06:16 +00:00
#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A simple script for file editing in dmenu
# - Dependencies: dmenu (Everything else can be changed)
# Show list of options
EDITOR="emacsclient -c -a emacs"
cd "$HOME" || exit 0
file=1
while [ "$file" ]; do
2022-07-02 00:51:53 +00:00
file=$(fd -LHpd 1 | dmenu -b -l 10 -p "File to edit: $(basename $(pwd))")
2022-07-01 06:06:16 +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