Files
dotwryn/zsh/rc.d/25.setup-editor.zsh
T

17 lines
430 B
Bash
Raw Normal View History

2024-05-07 16:38:40 -06:00
() { # set EDITOR/VISUAL variables
[[ ${#PREFERRED_EDITORS[@]} -eq 0 ]] && {
echo 'unable to find $PREFERRED_EDITORS environment variable'
return 1
}
local PROGRAM PROGRAM_EXECUTABLE
for PROGRAM in ${PREFERRED_EDITORS[@]}
do
PROGRAM_EXECUTABLE="$(which $PROGRAM 2>/dev/null)"
[ -f "$PROGRAM_EXECUTABLE" ] \
&& export EDITOR="$PROGRAM_EXECUTABLE" \
&& export VISUAL="$PROGRAM_EXECUTABLE" \
&& break
done
}