Fix LazyVim.sh script

This commit is contained in:
alvinlollo
2026-02-01 18:54:56 +11:00
parent 242cd9afc0
commit 3910c42b73
+52 -26
View File
@@ -1,51 +1,77 @@
# Install prerequisetes #!/usr/bin/bash
if command -v pacman >/dev/null; then
if ! command -v pacman >/dev/null; then
echo "Cannot proceed: Not a arch based system" echo "Cannot proceed: Not a arch based system"
echo "This script does not have debian support" echo "This script does not have debian support"
echo "+ sleep 10" && sleep 10 echo "+ sleep 10" && sleep 10
exit 1 exit 1
fi fi
# Install prerequisetes
sudo pacman -S --needed --noconfirm git curl wget python3 python-pip sudo pacman -S --needed --noconfirm git curl wget python3 python-pip
# Show nvim config replacement echo ""
echo 'This script will move your current nvim config to ~/.config/nvim.bak' echo 'This script will move your current nvim config to ~/.config/nvim.bak'
echo "Press CTRL+C within 20 secconds if you don't want these actions to be made" echo "Press CTRL+C within 20 secconds if you don't want these actions to be made"
sleep 20 sleep 20
echo ""
# Remove old backups # Remove old backups
if [ -e "~/.config/nvim.bak" ]; then # Remove existing .bak directories first to ensure a clean slate
# The path exists (it could be a file, a directory, a symlink, etc.) echo " Checking for and removing old Neovim backup directories..."
echo "Path ~/.config/nvim.bak exists. Running command..."
rm -rf ~/.config/nvim.bak # Use $HOME for reliable path expansion
if [ -e "$HOME/.config/nvim.bak" ]; then
echo "Path $HOME/.config/nvim.bak exists. Removing..."
rm -rf "$HOME/.config/nvim.bak"
fi fi
if [ -e "~/.local/share/nvim.bak" ]; then if [ -e "$HOME/.local/share/nvim.bak" ]; then
# The path exists (it could be a file, a directory, a symlink, etc.) echo "Path $HOME/.local/share/nvim.bak exists. Removing..."
echo "Path ~/.local/share/nvim.bak exists. Running command..." rm -rf "$HOME/.local/share/nvim.bak"
rm -rf ~/.local/share/nvim.bak
fi fi
if [ -e "~/.local/state/nvim.bak" ]; then if [ -e "$HOME/.local/state/nvim.bak" ]; then
# The path exists (it could be a file, a directory, a symlink, etc.) echo "Path $HOME/.local/state/nvim.bak exists. Removing..."
echo "Path ~/.local/state/nvim.bak exists. Running command..." rm -rf "$HOME/.local/state/nvim.bak"
rm -rf ~/.local/state/nvim.bak
fi fi
if [ -e "~/.cache/nvim.bak" ]; then if [ -e "$HOME/.cache/nvim.bak" ]; then
# The path exists (it could be a file, a directory, a symlink, etc.) echo "Path $HOME/.cache/nvim.bak exists. Removing..."
echo "Path ~/.cache/nvim.bak exists. Running command..." rm -rf "$HOME/.cache/nvim.bak"
rm -rf ~/.cache/nvim.bak
fi fi
# LazyVim Backup # Remove the current nvim config and create a new backup
mv ~/.config/nvim{,.bak} echo ""
echo " Backing up current Neovim configuration..."
if [ -d "$HOME/.config/nvim" ]; then # Check if nvim config exists before moving
mv "$HOME/.config/nvim" "$HOME/.config/nvim.bak"
else
echo "No existing ~/.config/nvim found to back up."
fi
# optional but recommended echo ""
cp ~/.local/share/nvim{,.bak} -r echo " Backing up Neovim share, state, and cache directories..."
cp ~/.local/state/nvim{,.bak} -r if [ -d "$HOME/.local/share/nvim" ]; then
cp ~/.cache/nvim{,.bak} -r mv "$HOME/.local/share/nvim" "$HOME/.local/share/nvim.bak"
fi
if [ -d "$HOME/.local/state/nvim" ]; then
mv "$HOME/.local/state/nvim" "$HOME/.local/state/nvim.bak"
fi
if [ -d "$HOME/.cache/nvim" ]; then
mv "$HOME/.cache/nvim" "$HOME/.cache/nvim.bak"
fi
git clone https://github.com/alvinlollo/LazyVim ~/.config/nvim # Remove any leftover
if [ -e "$HOME/.config/.nvim" ]; then
echo ""
echo "Removing ~/.config/.nvim..."
rm -rf "$HOME/.config/.nvim"
fi
# Install LazyVim
echo ""
git clone https://github.com/alvinlollo/LazyVim "$HOME/.config/nvim"
# Dependencys for Gdoc.vim # Dependencys for Gdoc.vim
#wget https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/requirements.txt #wget https://raw.githubusercontent.com/alvinlollo/Single-install-script/refs/heads/main/requirements.txt