diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2024-09-21 15:24:57 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2024-09-21 15:24:57 +0900 |
| commit | a7817b0c90b31a4270e72231e03824536975aad5 (patch) | |
| tree | bd3aa3883ba02834b7aa1ff99afcb80cbe878134 | |
| parent | e314f373d6d8c89cd774bab4535010c99edd06f3 (diff) | |
final tweak on copy.sh
| -rwxr-xr-x | copy.sh | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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" |
