#!/usr/bin/env bash
# vim: set sw=2 ts=2 sts=2 et tw=80 fmr={{{,}}} fdl=0 fdm=marker:
set -euo pipefail
IFS=$'\n\t'

# dotfiles installer for when `make` is not available.

# XDG folder
mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config}

# Git config
git config --global color.ui true
git config --global core.editor vim
git config --global core.excludesfile ~/dotfiles/git/globalignore
git config --global diff.mnemonicPrefix true
echo "Git config done."

# Bash
~/dotfiles/bin/linkup ~/dotfiles/shell/bash_profile ~/.bash_profile
~/dotfiles/bin/linkup ~/dotfiles/shell/bashrc ~/.bashrc

# Zsh
~/dotfiles/bin/linkup ~/dotfiles/shell/env ~/.zshenv
~/dotfiles/bin/linkup ~/dotfiles/shell/zshrc ~/.zshrc

# Tmux
~/dotfiles/bin/linkup ~/dotfiles/tmux/tmux.conf ~/.tmux.conf

# Ack
~/dotfiles/bin/linkup ~/dotfiles/ack/ackrc ~/.ackrc

# Vim
~/dotfiles/bin/linkup ~/dotfiles/vim ~/.vim
~/dotfiles/bin/linkup ~/dotfiles/vim/vimrc ~/.vimrc
~/dotfiles/bin/linkup ~/dotfiles/vim $XDG_CONFIG_HOME/nvim
# Use barebones config to avoid vimrc errors on fresh dotfiles installs.
#vim -N -u ~/dotfiles/vim/plugins.vim +PlugClean! +PlugUpdate! +quitall!

echo "Install complete!"
