From 7a8fafdff7dc2b18bfbe07a3db793623d09e3c45 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 12 May 2025 13:56:37 +0200 Subject: [PATCH] testing bash arrays.. --- neovim.sh | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/neovim.sh b/neovim.sh index b709609..d0e65e7 100644 --- a/neovim.sh +++ b/neovim.sh @@ -51,12 +51,6 @@ [alpine]="depsAlpine" [opensuse]="depsOpensuse" ) - # declare -A deps - # deps[debian]="depsDebian" - # deps[fedora]="depsFedora" - # deps[opensuse]="depsOpensuse" - # deps[arch]="depsArch" - # deps[alpine]="depsAlpine" declare -n pkgArray="${deps[$distro]}" @@ -70,8 +64,8 @@ } cloneSources() { - local cloneDir="$(mktemp -d)" - echo_info "Cloning neovim sources into tempdir at $cloneDir" + cloneDir="$(mktemp -d)" + echo_info "Cloning neovim sources into tempdir at $cloneDir/neovim" cd $cloneDir || mkdir $cloneDir && cd $cloneDir if command_exists git; then @@ -84,6 +78,7 @@ echo_error "Git was required, but is missing.. exiting now" exit 1 fi + } makeInstall() { @@ -101,6 +96,24 @@ if [ -d "$HOME/.config/nvim/" ]; then echo_info "Prefetching neovim setup configuration.." run nvim --headless +q + else + echo_warning "You don't have a neovim config installed. Do you want to clone one now? [Y]es (standard), [m]inimal, [n]o" + read -r askNvim + + case "$askNvim" in + [Yy]) + git clone --recursive --depth=1 https://git.k4li.de/dotfiles/nvim.git "$HOME/.config/nvim" + sleep 0.2 + run nvim --headless +q + ;; + [Mm]) + git clone --recursive --depth=1 https://git.k4li.de/dotfiles/nvim-mini.git "$HOME/.config/nvim" + sleep 0.2 + run nvim --headless +q + ;; + [Nn]) return 0 ;; + *) return 69 ;; + esac fi } @@ -119,5 +132,9 @@ installBuildDependencies cloneSources makeInstall + + echo_note "Cleaning up old $cloneDir directory.." + rm -rf "$cloneDir" + checkAndInitConfig }