Upload files to "/"
This commit is contained in:
commit
20caca2df3
111
install-nvchad.sh
Normal file
111
install-nvchad.sh
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
NO_FORMAT="\033[0m"
|
||||||
|
C_RED="\033[38;5;9m"
|
||||||
|
C_LIME="\033[38;5;10m"
|
||||||
|
|
||||||
|
function main ()
|
||||||
|
{
|
||||||
|
if [ "$EUID" -eq 0 ]
|
||||||
|
then echo -e "${C_RED}Script cannot be run as root !${NO_FORMAT}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
mkdir -p /tmp/nvchad-installer/
|
||||||
|
|
||||||
|
check_and_install_nvim
|
||||||
|
|
||||||
|
check_and_install_nerdfont
|
||||||
|
|
||||||
|
check_and_install_nvchad
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
echo -e "${C_LIME}Script has finished running !${NO_FORMAT}"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_wget ()
|
||||||
|
{
|
||||||
|
if ! command -v "wget" > /dev/null;
|
||||||
|
then
|
||||||
|
echo "wget is required to use the script"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_and_install_nvim ()
|
||||||
|
{
|
||||||
|
if command -v "nvim" > /dev/null
|
||||||
|
then
|
||||||
|
echo "Neovim is already installed on your system, skipping installation"
|
||||||
|
else
|
||||||
|
# Nvim download
|
||||||
|
check_wget
|
||||||
|
echo "Downloading latest neovim release..."
|
||||||
|
wget -q --show-progress https://github.com/neovim/neovim/releases/latest/download/nvim.appimage -P /tmp/nvchad-installer/
|
||||||
|
|
||||||
|
# Update $PATH
|
||||||
|
echo "Adding ~/.local/bin to your \$PATH..."
|
||||||
|
echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
|
||||||
|
source ~/.bashrc
|
||||||
|
|
||||||
|
# Move nvim to PATH
|
||||||
|
echo "Placing nvim appimage in ~/.local/bin/..."
|
||||||
|
mkdir -p ~/.local/bin/
|
||||||
|
chmod +x /tmp/nvchad-installer/nvim.appimage
|
||||||
|
mv /tmp/nvchad-installer/nvim.appimage ~/.local/bin/nvim
|
||||||
|
|
||||||
|
echo -e "${C_LIME}Neovim is now installed !${NO_FORMAT}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_and_install_nerdfont ()
|
||||||
|
{
|
||||||
|
FILE=$HOME/.fonts/JetBrainsMonoNLNerdFont-Regular.ttf
|
||||||
|
if [ -f "$FILE" ]; then
|
||||||
|
echo "$FILE already exists, skipping installation..."
|
||||||
|
else
|
||||||
|
check_wget
|
||||||
|
|
||||||
|
echo "Downloading JetBrainsMono Nerd font..."
|
||||||
|
wget -q --show-progress https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip -P /tmp/nvchad-installer/
|
||||||
|
|
||||||
|
echo "Unzipping JetBrainsMono Nerd font..."
|
||||||
|
unzip -j "/tmp/nvchad-installer/JetBrainsMono.zip" "JetBrainsMonoNLNerdFont-Regular.ttf" -d "/tmp/nvchad-installer/"
|
||||||
|
|
||||||
|
echo "Installing the NerdFont..."
|
||||||
|
mkdir -p ~/.fonts
|
||||||
|
mv /tmp/nvchad-installer/JetBrainsMonoNLNerdFont-Regular.ttf ~/.fonts
|
||||||
|
|
||||||
|
echo -e "${C_LIME}JetBrainsMono NerdFont is now installed !${NO_FORMAT}"
|
||||||
|
|
||||||
|
read -p "To enable the Nerd font, open terminal preferences and set the font to JetBrainsMono Nerd Font (Press Enter when done)"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
check_and_install_nvchad ()
|
||||||
|
{
|
||||||
|
NVIM_CONFIG=$HOME/.config/nvim/
|
||||||
|
if [ -d "$NVIM_CONFIG" ]; then
|
||||||
|
echo "$NVIM_CONFIG already exists, skipping installation..."
|
||||||
|
else
|
||||||
|
echo "Installing NvChad..."
|
||||||
|
git clone https://github.com/NvChad/starter $NVIM_CONFIG
|
||||||
|
|
||||||
|
read -p "Neovim is about to launch. After it has finished installing plugins, please run ':MasonInstallAll' to install parsers (Press Enter to continue)"
|
||||||
|
nvim
|
||||||
|
|
||||||
|
echo -e "${C_LIME}NvChad is now installed !${NO_FORMAT}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup ()
|
||||||
|
{
|
||||||
|
[ -f /tmp/nvchad-installer/JetBrainsMono.zip ] && {
|
||||||
|
echo "Removing JetBrainsMono font zipfile...";
|
||||||
|
rm /tmp/nvchad-installer/JetBrainsMono.zip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
Loading…
Reference in New Issue
Block a user