Last active
January 24, 2022 20:34
-
-
Save NickCrew/86359f91376b49f0b011bc1ad4b1dcac to your computer and use it in GitHub Desktop.
Install dotfiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
proto=git | |
[email protected]: | |
dots_branch=master | |
if [[ ! -z $1 ]]; then | |
proto=$1 | |
if [[ $proto == "https" ]]; then | |
remote_url=https://github.com/ | |
else | |
echo "Invalid git protocol: ${proto}" | |
echo "USAGE: setup [git|https]" | |
exit 1 | |
fi | |
fi | |
remote_proj=${remote_url}NickCrew | |
if [[ ! -z "$2" ]]; then | |
dots_branch="$2" | |
fi | |
mkdir -p ~/.cache/nvim/undo | |
mkdir -p ~/.cache/zsh | |
git clone --bare ${remote_proj}/dotfiles.git -b $dots_branch ~/.dots | |
function dots () { | |
git --work-tree=${HOME} --git-dir=${HOME}/.dots "$@" | |
} | |
dots checkout | |
dots config status.showUntrackedFiles no | |
git clone ${remote_proj}/zsh-config ~/.zsh | |
git clone ${remote_proj}/nvim-config ~/.config/nvim | |
git clone ${remote_proj}/tmux-config ~/.tmux.conf.d | |
# Setup ZSH config | |
if [[ -f ~/.zshenv ]]; then | |
mv ~/.zshenv ~/.zshenv.orig | |
fi | |
echo 'export ZDOTDIR="${HOME}/.zsh"' > ~/.zshenv | |
# Setup tmux config | |
if [[ -f ~/.tmux.conf ]]; then | |
mv ~/.tmux.conf ~/.tmux.conf.orig | |
fi | |
echo 'source ~/.tmux.conf.d/default.conf' > ~/.tmux.conf | |
echo "Finished installing dotfiles." | |
echo "You will need to reload your ZSH and/or tmux session(s)." | |
echo "For more info on installing Neovim dependencies, see: https://github.com/NickCrew/neovim-config/README.md" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment