Skip to content

Commit db9c4e4

Browse files
committed
Added automatic installation choice for hack nerd font
Also made minor changes
1 parent f39f4e8 commit db9c4e4

File tree

1 file changed

+60
-8
lines changed

1 file changed

+60
-8
lines changed

installGarudaNvim.sh

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ echo
1414
echo "=================================================================================================================="
1515
echo
1616

17-
# Step 0: Detect OS
17+
# Step 1: Detect OS
1818
echo "Step 1: Detecting Operating System"
1919
echo "------------------------------------------------------------------------------------------------------------------"
2020
OS=""
@@ -60,7 +60,7 @@ echo "INFO: System checks passed! Continuing with installation."
6060
echo
6161
echo
6262

63-
# Step 1: Check if Neovim is installed
63+
# Step 2: Check if Neovim is installed
6464
echo "Step 2: Checking if Neovim is already installed"
6565
echo "------------------------------------------------------------------------------------------------------------------"
6666
if command -v nvim >/dev/null 2>&1; then
@@ -107,12 +107,12 @@ fi
107107
echo
108108
echo
109109

110-
# Step 1.5: Checking for System Dependencies
110+
# Step 3: Checking for System Dependencies
111111
echo "Step 3: Checking for GarudaNvim Dependencies"
112112
echo "------------------------------------------------------------------------------------------------------------------"
113113
echo "Checking for the following dependencies on your system:"
114-
echo "Node, Python, Ripgrep, Lazygit, Htop"
115-
echo "Though these are not strictly needed, it's recommended to have them for a seamless GarudaNvim experience."
114+
echo "Node, Python, Ripgrep, Lazygit, Htop, Hack Nerd Font"
115+
echo "Though these are not strictly required, having them provides a seamless GarudaNvim experience."
116116
echo
117117

118118
dependencies=("node" "python3" "rg" "lazygit" "htop")
@@ -127,11 +127,14 @@ for dep in "${dependencies[@]}"; do
127127
fi
128128
done
129129

130+
# Display information on installed and missing dependencies
130131
if [ ${#missing_dependencies[@]} -eq 0 ]; then
131-
echo "INFO: All dependencies are already installed."
132+
echo "INFO: All essential dependencies are already installed."
132133
else
133134
echo "INFO: Found installed dependencies: ${installed_dependencies[*]}"
134135
echo "INFO: Missing dependencies: ${missing_dependencies[*]}"
136+
137+
# Prompt to install missing dependencies
135138
for dep in "${missing_dependencies[@]}"; do
136139
echo
137140
read -p "Would you like to install $dep? (y/n): " install_choice
@@ -185,11 +188,60 @@ else
185188
fi
186189
done
187190
fi
191+
192+
# Check and install Hack Nerd Font
193+
echo
194+
echo "Checking for Hack Nerd Font..."
195+
FONT_NAME="Hack Nerd Font"
196+
if [ "$OS" = "macOS" ]; then
197+
FONT_DIR="$HOME/Library/Fonts"
198+
else
199+
FONT_DIR="$HOME/.local/share/fonts"
200+
fi
201+
FONT_PATH="$FONT_DIR/HackNerdFont-Regular.ttf"
202+
203+
if [ -f "$FONT_PATH" ]; then
204+
echo "INFO: $FONT_NAME is already installed."
205+
else
206+
echo "$FONT_NAME is not installed on your system."
207+
echo "It is recommended for GarudaNvim to display icons correctly and enhance readability."
208+
echo
209+
read -p "Would you like to install $FONT_NAME? (y/n): " install_font_choice
210+
211+
if [ "$install_font_choice" = "y" ]; then
212+
echo
213+
echo "INFO: Installing $FONT_NAME..."
214+
215+
# Ensure the font directory exists
216+
mkdir -p "$FONT_DIR"
217+
218+
# Download Hack Nerd Font
219+
curl -fLo "$FONT_DIR/Hack.zip" https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Hack.zip
220+
221+
# Unzip and install the font
222+
unzip -o "$FONT_DIR/Hack.zip" -d "$FONT_DIR"
223+
rm "$FONT_DIR/Hack.zip"
224+
225+
# Refresh the font cache for Linux
226+
if [ "$OS" != "macOS" ]; then
227+
if command -v fc-cache >/dev/null 2>&1; then
228+
fc-cache -f -v
229+
fi
230+
fi
231+
232+
echo
233+
echo "INFO: $FONT_NAME has been successfully installed!"
234+
else
235+
echo
236+
echo "INFO: You chose not to install $FONT_NAME."
237+
echo "GarudaNvim may not display icons correctly without it."
238+
fi
239+
fi
188240
echo
189241
echo
190242

191243

192-
# Step 2: Check for existing Neovim configuration
244+
# Step 4: Check for existing Neovim configuration
193245
echo "Step 4: Checking for existing Neovim configuration in ~/.config/nvim"
194246
echo "------------------------------------------------------------------------------------------------------------------"
195247
if [ -d ~/.config/nvim ]; then
@@ -236,7 +288,7 @@ fi
236288
echo
237289
echo
238290

239-
# Step 3: Cloning GarudaNvim repository
291+
# Step 5: Cloning GarudaNvim repository
240292
echo "Step 5: Installing GarudaNvim to ~/.config/nvim"
241293
echo "------------------------------------------------------------------------------------------------------------------"
242294
# Clone the repository

0 commit comments

Comments
 (0)