Skip to content

Instantly share code, notes, and snippets.

@fikovnik
Last active June 7, 2023 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fikovnik/94ac35dc396202fea33580c08280e50f to your computer and use it in GitHub Desktop.
Save fikovnik/94ac35dc396202fea33580c08280e50f to your computer and use it in GitHub Desktop.
Install dotfiles
#!/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