neodotfiles/source/dmenu/scripts/dmenu_edit

27 lines
720 B
Text
Raw Normal View History

2024-03-28 21:40:01 +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, fd
2024-08-13 13:07:56 +00:00
# start from home directory
2024-03-28 21:40:01 +00:00
cd "$HOME" || exit 0
2024-08-13 13:07:56 +00:00
2024-03-28 21:40:01 +00:00
file=1
while [ "$file" ]; do
file=$(fd -LHpd 1 | dmenu -i -l 10 -p "󰈙 Open file in text editor $(basename "$(pwd)")")
if [ -e "$file" ]; then
owd=$(pwd)
if [ -d "$file" ]; then
cd "$file" || exit 0
else [ -f "$file" ]
if [ "$file" ]; then
$VISUAL "$owd/$file" & # $VISUAL reffers to a global variable set in .xinitrc/.bash_profile
exit 0
else
exit 0
fi
fi
fi
done