From de982113f4c4b9387cc2c04a0d79d8ed7def820d Mon Sep 17 00:00:00 2001 From: TiagoRG Date: Sun, 22 Oct 2023 00:30:19 +0100 Subject: [PATCH] Add setup Signed-off-by: TiagoRG --- setup | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 setup diff --git a/setup b/setup new file mode 100755 index 0000000..4af5194 --- /dev/null +++ b/setup @@ -0,0 +1,88 @@ +#!/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" + + cp -r .config/nvim ~/.config/ + + # Install vim-plug + git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim + + echo -e "\033[0;32mNeovim setup complete!\033[0m" +} + +setup_zsh() { + echo -e "\033[0;33mSetting up zsh...\033[0m" + + cp -r .zsh ~/ + echo "ZDOTDIR=$HOME/.zsh" >> ~/.zshenv + + echo -e "\033[0;32mzsh setup complete!\033[0m" +} + +setup_bin() { + echo -e "\033[0;33mSetting up bin...\033[0m" + + cp -r .local/bin ~/.local/ + + echo -e "\033[0;32mbin 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" \ + "bin" \ + --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_bin + ;; + "Neovim") + setup_nvim + ;; + "zshrc") + setup_zsh + ;; + "bin") + setup_bin + ;; + *) + echo -e "\033[0;31mInvalid option. Exiting...\033[0m" + exit + ;; +esac + +echo -e "\033[0;32mSetup complete!\033[0m" +# ------------------- End of Main -------------------