#!/usr/bin/env bash
git submodule update --init --recursive
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh

rm -rf ~/.config/autostart/*
cp -rf ./.config ~
cp -rf ./.zcustom ~
cp -rf ./.doom.d ~

cp -f ./.zshrc ~
cp -f ./.zshenv ~
cp -f ./.profile ~
cp -f ./.xsession ~
cp -f ./.ideavimrc ~
cp -f ./.vimrc ~
cp -f ./.gitconfig ~

if [ -n "$(command -v vim)" ]; then
    curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
        https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    vim +PlugInstall +qall
fi

if [ -n "$(command -v nvim)" ]; then
    sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
        https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
    nvim +PlugInstall +qall
fi

echo "Done installing configs."
