aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaKooLit <ejhay.games@gmail.com>2024-09-21 15:24:57 +0900
committerJaKooLit <ejhay.games@gmail.com>2024-09-21 15:24:57 +0900
commita7817b0c90b31a4270e72231e03824536975aad5 (patch)
treebd3aa3883ba02834b7aa1ff99afcb80cbe878134
parente314f373d6d8c89cd774bab4535010c99edd06f3 (diff)
final tweak on copy.sh
-rwxr-xr-xcopy.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/copy.sh b/copy.sh
index e7bf6aa9..c75137c4 100755
--- a/copy.sh
+++ b/copy.sh
@@ -207,25 +207,32 @@ update_editor() {
echo "${OK} Default editor set to ${ORANGE}$editor${RESET}." 2>&1 | tee -a "$LOG"
}
+EDITOR_SET=0
+
# Check for neovim if installed
if command -v nvim &> /dev/null; then
printf "${INFO} ${ORANGE}neovim${RESET} is detected as installed\n"
read -p "${CAT} Do you want to make ${ORANGE}neovim${RESET} the default editor? (y/n): " EDITOR_CHOICE
if [[ "$EDITOR_CHOICE" == "y" ]]; then
update_editor "nvim"
- exit 0
+ EDITOR_SET=1
fi
fi
-# Check for vim if installed
-if command -v vim &> /dev/null; then
+printf "\n"
+
+# Check for vim if installed, but only if neovim wasn't chosen
+if [[ "$EDITOR_SET" -eq 0 ]] && command -v vim &> /dev/null; then
printf "${INFO} ${ORANGE}vim${RESET} is detected as installed\n"
read -p "${CAT} Do you want to make ${ORANGE}vim${RESET} the default editor? (y/n): " EDITOR_CHOICE
if [[ "$EDITOR_CHOICE" == "y" ]]; then
update_editor "vim"
+ EDITOR_SET=1
fi
-else
- echo "${ORANGE} Neither neovim nor vim is installed."
+fi
+
+if [[ "$EDITOR_SET" -eq 0 ]]; then
+ echo "${ORANGE} Neither neovim nor vim is installed or selected as default."
fi
printf "\n"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage