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

26 lines
674 B
Text
Raw Normal View History

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
cd "$HOME" || exit 0
file=1
while [ "$file" ]; do
2023-06-24 17:00:22 +00:00
file=$(fd -LHpd 1 | dmenu -i -l 10 -p "󰈙 Open file in text editor $(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
2023-06-24 17:00:22 +00:00
$VISUAL "$owd/$file" &
2022-09-13 01:06:55 +00:00
exit 0
else
exit 0
fi
fi
fi
done