From b33247d5652e0d43d53bbb28c0a971ea0c3abdb7 Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 3 Jul 2026 00:18:29 +0400 Subject: [PATCH] debian alternatives --- install.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index e51e370..6d76e6e 100755 --- a/install.sh +++ b/install.sh @@ -46,22 +46,24 @@ function raise_error { message=${1:-an undefined error has occured!} code=${2:-1} echo "error ${code}: ${message}" >&2 - exit ${code} + exit "${code}" } function set_alternative { - local key=$1 + local key command path_to_command path_to_key + key=$1 [[ -f /etc/alternatives/$key ]] || raise_error "alternative <${key}> not found!" 11 - local path_to_key=$(readlink -f /usr/bin/$key) + path_to_key=$(readlink "/etc/alternatives/$key") - local command=$2 - local path_to_command=$(command -v "${command}") + command=$2 + path_to_command=$(command -v "${command}") if [[ "${path_to_key}" != "${path_to_command}" ]]; then + echo "$key: $path_to_key != $path_to_command" sudo -vp 'sudo for update-alternatives: ' - sudo update-alternatives --install /usr/bin/${key} ${key} ${path_to_command} 100 - sudo update-alternatives --set ${key} ${path_to_command} + sudo update-alternatives --install "/usr/bin/${key}" "${key}" "${path_to_command}" 100 + sudo update-alternatives --set "${key}" "${path_to_command}" else echo "alternative ${key} => ${command}" fi @@ -77,6 +79,14 @@ function configure_default { set_alternative vim nvim } + +function install_neovim { + if ! grep -q nvim-vanilla ~/.bashrc; then + alias nvim-vanilla='NVIM_APPNAME=nvim-vanilla nvim' + else + echo 'nvim-vanilla ready!' + fi +} ## MAIN assert_debian13 @@ -86,5 +96,6 @@ echo "MIAOU-DESKTOP installation..." install_ghostty # install_homebrew +install_neovim configure_default echo SUCCESS