dotfiles/setup.sh

53 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
#
cd $(dirname $0)
DOTS_DIR=$(pwd)
function link_config {
NAME="$1"
TARGET="$2"
FROM="$DOTS_DIR/$3"
if [ -d "$TARGET" ]; then
echo "[$NAME] Configuration directory exists. Skipping."
else
ln -s "$FROM" "$TARGET"
fi
}
link_config "Dunst" "$HOME/.config/dunst" "dunst"
link_config "Kitty" "$HOME/.config/kitty" "kitty"
link_config "Eww" "$HOME/.config/eww" "eww"
# Neovim
NVIM_DIR="$HOME/.config/nvim"
# Check if the NVIM directory exists. If it does we skip this part of the script and inform the user.
if [ -d $NVIM_DIR ]; then
echo "[NVIM] Configuration directory exists. Skipping."
else
# Symlink the config.
ln -s $DOTS_DIR/nvim $NVIM_DIR
# Bootstrap the plugins
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
fi
# Scripts
SCRIPT_DIR="$HOME/bin/scripts"
# Check if the scripts directory exists. If it does we skip this part of the script and inform the user.
if [ -d $SCRIPT_DIR ]; then
echo "[SCRIPTS] Configuration directory exists. Skipping."
else
mkdir "$HOME/bin"
ln -s $DOTS_DIR/scripts $SCRIPT_DIR
fi
# Templates
TEMPLATE_DIR="$HOME/Templates"
rmdir "$TEMPLATE_DIR"
ln -s "$DOTS_DIR/Templates" "$TEMPLATE_DIR"