2024-09-12 20:46:41 +01:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2024-09-21 15:26:32 +01:00
|
|
|
. ../../common-script.sh
|
2024-09-12 20:46:41 +01:00
|
|
|
|
|
|
|
gitpath="$HOME/.local/share/neovim"
|
|
|
|
|
|
|
|
cloneNeovim() {
|
2024-09-14 13:07:22 +01:00
|
|
|
# Check if the dir exists before attempting to clone into it.
|
|
|
|
if [ -d "$gitpath" ]; then
|
|
|
|
rm -rf "$gitpath"
|
|
|
|
fi
|
2024-09-12 20:46:41 +01:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2024-09-17 03:10:02 +01:00
|
|
|
installNeovim() {
|
2024-09-20 15:27:31 +01:00
|
|
|
if ! command_exists neovim ripgrep git fzf; then
|
2024-09-18 19:14:04 +01:00
|
|
|
printf "%b\n" "${YELLOW}Installing Neovim...${RC}"
|
2024-09-12 20:46:41 +01:00
|
|
|
case "$PACKAGER" in
|
|
|
|
pacman)
|
2024-09-19 01:03:32 +01:00
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
|
2024-09-12 20:46:41 +01:00
|
|
|
;;
|
2024-09-19 19:40:18 +01:00
|
|
|
apt-get|nala)
|
2024-09-30 21:34:26 +01:00
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" install -y ripgrep fd-find python3-venv luarocks golang-go shellcheck git
|
|
|
|
curl -sSLo /tmp/nvim.appimage https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
|
|
|
|
chmod u+x /tmp/nvim.appimage
|
|
|
|
"$ESCALATION_TOOL" mv /tmp/nvim.appimage /usr/local/bin/nvim
|
2024-09-12 20:46:41 +01:00
|
|
|
;;
|
2024-09-22 23:21:05 +01:00
|
|
|
dnf|zypper)
|
2024-09-19 01:03:32 +01:00
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
|
2024-09-12 20:46:41 +01:00
|
|
|
;;
|
2024-10-13 02:42:34 +01:00
|
|
|
apk)
|
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" add neovim
|
|
|
|
;;
|
2024-09-12 20:46:41 +01:00
|
|
|
*)
|
2024-09-22 17:01:10 +01:00
|
|
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
2024-09-12 20:46:41 +01:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2024-09-20 15:27:31 +01:00
|
|
|
fi
|
2024-09-12 20:46:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
backupNeovimConfig() {
|
2024-09-17 04:11:04 +01:00
|
|
|
printf "%b\n" "${YELLOW}Backing up existing configuration files...${RC}"
|
2024-09-15 13:08:18 +01:00
|
|
|
if [ -d "$HOME/.config/nvim" ] && [ ! -d "$HOME/.config/nvim-backup" ]; then
|
|
|
|
cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup"
|
|
|
|
fi
|
2024-09-12 20:46:41 +01:00
|
|
|
rm -rf "$HOME/.config/nvim"
|
|
|
|
}
|
|
|
|
|
|
|
|
linkNeovimConfig() {
|
2024-09-17 04:11:04 +01:00
|
|
|
printf "%b\n" "${YELLOW}Linking Neovim configuration files...${RC}"
|
2024-09-12 20:46:41 +01:00
|
|
|
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
|
2024-09-17 03:10:02 +01:00
|
|
|
installNeovim
|
2024-09-18 19:38:36 +01:00
|
|
|
cloneNeovim
|
2024-09-12 20:46:41 +01:00
|
|
|
backupNeovimConfig
|
2024-09-19 19:40:18 +01:00
|
|
|
linkNeovimConfig
|