linutil/core/tabs/applications-setup/Developer-tools/neovim-setup.sh
Nyx cca2660c3b
fix every issue related to printf (#596)
* increase synergy between scripts

* Fix newlines Fix packagers etc

* fix an issue with no new line being created

* fix formatting

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* fix extra comma

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* change to ()

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* change to ()

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* change to ()

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* change to ()

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* remove extra comma

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* remove "please"

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* add support for caps

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* add support for caps

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* add support for caps

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* remove \n and make the default option "N"

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* add an extra quote

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>

* add extra quotes

* fix remaining sn

* fix remaining new lines

---------

Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
2024-09-22 11:01:10 -05:00

60 lines
1.9 KiB
Bash
Executable File

#!/bin/sh -e
. ../../common-script.sh
gitpath="$HOME/.local/share/neovim"
cloneNeovim() {
# Check if the dir exists before attempting to clone into it.
if [ -d "$gitpath" ]; then
rm -rf "$gitpath"
fi
mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist.
cd "$HOME" && git clone https://github.com/ChrisTitusTech/neovim.git "$HOME/.local/share/neovim"
}
installNeovim() {
if ! command_exists neovim ripgrep git fzf; then
printf "%b\n" "${YELLOW}Installing Neovim...${RC}"
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
;;
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
;;
esac
fi
}
backupNeovimConfig() {
printf "%b\n" "${YELLOW}Backing up existing configuration files...${RC}"
if [ -d "$HOME/.config/nvim" ] && [ ! -d "$HOME/.config/nvim-backup" ]; then
cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup"
fi
rm -rf "$HOME/.config/nvim"
}
linkNeovimConfig() {
printf "%b\n" "${YELLOW}Linking Neovim configuration files...${RC}"
mkdir -p "$HOME/.config/nvim"
ln -s "$gitpath/titus-kickstart/"* "$HOME/.config/nvim/" # Wild card is used here to link all contents of titus-kickstart.
}
checkEnv
checkEscalationTool
installNeovim
cloneNeovim
backupNeovimConfig
linkNeovimConfig