.dotfiles/setup

88 lines
2.1 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# Exit if ran using sh
if [ ! "$BASH_VERSION" ] ; then
printf "\033[0;31mPlease run the script using 'bash' instead of 'sh'\033[0m\n"
exit
fi
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
cd "$parent_path" || exit
# ------------------- Config functions -------------------
setup_nvim() {
echo -e "\033[0;33mSetting up neovim...\033[0m"
sudo pacman -S neovim
# Install packer.nvim
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
# Install plugins
nvim --headless -c 'source ~/.config/nvim/lua/tiagorg/packer.lua' -c 'PackerSync'
echo -e "\033[0;32mNeovim setup complete!\033[0m"
}
setup_zsh() {
echo -e "\033[0;33mSetting up zsh...\033[0m"
git submodule update --init .zsh/zsh-autosuggestions
git submodule update --init .zsh/zsh-syntax-highlighting
sudo pacman -S zsh
sudo chsh tiagorg --shell=/usr/bin/zsh
sudo chsh root --shell=/usr/bin/zsh
echo -e "\033[0;32mzsh setup complete!\033[0m"
}
# ------------------- End of config functions -------------------
# ------------------- Main -------------------
# Menu to choose the config_option
config_option=$(zenity --list \
--title="TiagoRG Dotfiles" \
--column="Selected the config option" \
"Full setup" \
"Neovim" \
"zshrc" \
--width=500 --height=400)
# Check if the user selected an option
if [ -z "$config_option" ]; then
echo -e "\033[0;31mNo option selected. Exiting...\033[0m"
exit
fi
echo -e "\033[0;33mSelected option: $config_option\033[0m"
# Check which option was selected
case $config_option in
"Full setup")
setup_nvim
setup_zsh
setup_gnome_shell
;;
"Neovim")
setup_nvim
;;
"zshrc")
setup_zsh
;;
"gnome-shell")
setup_gnome_shell
;;
*)
echo -e "\033[0;31mInvalid option. Exiting...\033[0m"
exit
;;
esac
echo -e "\033[0;32mSetup complete!\033[0m"
# ------------------- End of Main -------------------