Skip to content

Instantly share code, notes, and snippets.

@ErichDonGubler
Last active May 19, 2017 01:22
Show Gist options
  • Save ErichDonGubler/e0f5a2ba8848a63dc3a9ec1ef5a72c46 to your computer and use it in GitHub Desktop.
Save ErichDonGubler/e0f5a2ba8848a63dc3a9ec1ef5a72c46 to your computer and use it in GitHub Desktop.
A Bash script that sets up erichdongubler's dotfiles repo locally and deploys immediately
# Shamelessly copied and adapted from https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
pushd "$HOME" > /dev/null
git clone --bare https://github.com/ErichDonGubler/.dotfiles.git ~/.dotfiles.git
function .git() {
git --git-dir="$HOME/.dotfiles.git/" --work-tree="$HOME" $*
}
.git checkout
if [ $? = 0 ]; then
echo "Checked out dotfiles.";
else
echo "Backing up pre-existing dot files.";
mkdir -p .dotfiles-backup
.git checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles-backup/{}
fi;
.git checkout
.git config status.showUntrackedFiles no
echo 'Sourcing ~/.bashrc...'
. ~/.bashrc
echo "Downloading submodules (if any)..."
.git up
echo "Installing vim plugins..."
mkdir -p ~/.vim/.{swapfiles,backups}
vim +PlugInstall +qall
echo "Installing TPM plugins..."
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins
popd > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment