Last active
June 7, 2023 09:01
-
-
Save fikovnik/94ac35dc396202fea33580c08280e50f 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
#!/bin/bash -x | |
BACKUP_DIR="$HOME/.dotfiles-backup" | |
[ -d $HOME/.dotfiles ] || git clone --bare https://github.com/fikovnik/dot-files.git $HOME/.dotfiles | |
function config { | |
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@ | |
} | |
config checkout | |
if [ $? -ne 0 ]; then | |
echo "Backing up pre-existing dot files."; | |
[[ -d "$BACKUP_DIR" ]] || mkdir -p "$BACKUP_DIR" | |
for f in $(config checkout 2>&1 | egrep "\s+\." | awk {'print $1'}); do | |
target="$BACKUP_DIR/$f" | |
d=$(dirname "$target") | |
[ -d "$d" ] || mkdir -p "$d" | |
mv "$f" "$target" | |
done | |
fi | |
config checkout | |
config submodule init | |
config submodule update --init --recursive | |
config config status.showUntrackedFiles no | |
config config --local core.worktree $HOME | |
# tmux plugin manager | |
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
/home/krikava/.tmux/plugins/tpm/bindings/install_plugin | |
# zsh config | |
git clone --recursive https://github.com/fikovnik/prezto "${ZDOTDIR:-$HOME}/.zprezto" | |
# nvim config | |
if command nvim 2>/dev/null; then nvim +"Lazy sync" fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment