Skip to content

Commit 95c040d

Browse files
committed
Added an option to backup or delete their existing configuration(if any)
Not removing the .git folder from now on to get updates
1 parent 849cceb commit 95c040d

2 files changed

Lines changed: 50 additions & 19 deletions

File tree

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
# Installer
2-
Automatically installs GarudaNvim with one command
2+
Automatically installs GarudaNvim with a single command
3+
</br>
4+
Run the following command to install GarudaNvim:
5+
```
6+
wget -q https://raw.githubusercontent.com/GarudaNvim/Installer/main/installGarudaNvim.sh
7+
chmod +x installGarudaNvim.sh && ./installGarudaNvim.sh
8+
rm installGarudaNvim.sh
9+
```

installGarudaNvim.sh

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,75 @@
44

55
# Welcome message
66
echo
7+
echo
78
echo "Welcome to GarudaNvim!"
89
echo "This installer is designed for macOS."
910
echo
10-
echo "================================================================================="
11+
echo "=================================================================================================================="
1112
echo
1213

1314
# Step 1: Check for existing Neovim configuration
1415
echo "Step 1: Checking for existing Neovim configuration in ~/.config/nvim"
15-
echo "---------------------------------------------------------------------------------"
16+
echo "------------------------------------------------------------------------------------------------------------------"
1617
if [ -d ~/.config/nvim ]; then
17-
echo "ERROR: The directory ~/.config/nvim already exists."
18-
echo " Please move it to a different location and try again."
18+
echo "WARNING: The directory ~/.config/nvim already exists."
19+
echo " You have two options:"
20+
echo " 1. Delete your current Neovim configuration and install GarudaNvim."
21+
echo " 2. Backup your current Neovim configuration before installing GarudaNvim."
1922
echo
20-
exit 1
23+
read -p "Would you like to delete the existing configuration? (y/n): " delete_choice
24+
if [ "$delete_choice" = "y" ]; then
25+
echo "INFO: Deleting existing Neovim configuration..."
26+
# Deleting current configuration
27+
rm -rf ~/.config/nvim
28+
rm -rf ~/.local/share/nvim
29+
rm -rf ~/.local/state/nvim
30+
rm -rf ~/.cache/nvim
31+
echo "INFO: Existing configuration deleted."
32+
else
33+
echo
34+
echo "Step 1.5: Backup Options"
35+
echo "------------------------------------------------------------------------------------------------------------------"
36+
echo "You can either automatically backup your current Neovim configuration or manually do it."
37+
read -p "Would you like to automatically backup and proceed with the installation? (y/n): " backup_choice
38+
if [ "$backup_choice" = "y" ]; then
39+
echo "INFO: Backing up current Neovim configuration..."
40+
# Automatically backup the current configuration
41+
mv ~/.config/nvim{,.bak}
42+
# Optional but recommended backups
43+
mv ~/.local/share/nvim{,.bak}
44+
mv ~/.local/state/nvim{,.bak}
45+
mv ~/.cache/nvim{,.bak}
46+
echo "INFO: Backup complete!"
47+
else
48+
echo "INFO: Please manually backup your configuration and try installing GarudaNvim again."
49+
echo
50+
exit 1
51+
fi
52+
fi
53+
else
54+
echo "INFO: No existing Neovim configuration found."
2155
fi
22-
echo "INFO: No existing Neovim configuration found."
2356
echo
2457
echo
2558

2659
# Step 2: Cloning GarudaNvim repository
2760
echo "Step 2: Installing GarudaNvim to ~/.config/nvim"
28-
echo "---------------------------------------------------------------------------------"
61+
echo "------------------------------------------------------------------------------------------------------------------"
2962
git clone https://github.com/garudanvim/GarudaNvim.git ~/.config/nvim
3063
cd ~/.config/nvim || exit 1
3164
echo
32-
echo
33-
34-
# Step 3: Removing the .git folder
35-
echo "Step 3: Cleaning up"
36-
echo "---------------------------------------------------------------------------------"
37-
rm -rf .git
38-
echo ".git folder removed."
39-
echo
40-
echo "================================================================================="
65+
echo "=================================================================================================================="
4166
echo
4267

4368
# Success message
4469
echo "SUCCESS: GarudaNvim has been correctly installed!"
4570
echo "Happy Coding!"
4671
echo
47-
echo "================================================================================="
72+
echo "=================================================================================================================="
4873
echo
4974

5075
# Opening GarudaNvim
5176
echo "PRESS ENTER TO OPEN IT"
5277
read -r
5378
nvim
54-

0 commit comments

Comments
 (0)