dotfiles/script/installdotfiles

55 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
#
# Set up basic symlinks and directory structure when installing dotfiles.
2021-04-02 21:14:08 +00:00
# Expected to be idempotent.
set -e
# General
2023-10-07 08:43:32 +00:00
mkdir -p "$HOME/dev"
ln -sfn "$HOME/dev/dotfiles/script" "$HOME/script"
# ZSH
2023-10-07 08:43:32 +00:00
mkdir -p "$HOME/.config/zsh/functions"
# TODO: ZSH on Mac appears to load zshenv from ZDOTDIR, not HOME.
# Try to consolidate this.
2023-10-07 08:43:32 +00:00
if [ "$(uname -s)" = "Darwin" ]; then
envpath="$HOME/.config/zsh/.zshenv"
else
envpath="$HOME/.zshenv"
fi
2023-10-07 08:43:32 +00:00
ln -sfn "$HOME/dev/dotfiles/zshenv" "$envpath"
ln -sfn "$HOME/dev/dotfiles/zshrc" "$HOME/.config/zsh/.zshrc"
secretsfile="$HOME/.config/zsh/.zshsecrets"
if [ ! -f "$secretsfile" ]; then
2023-10-07 08:43:32 +00:00
cp "$HOME/dev/dotfiles/zshsecrets.example" "$secretsfile"
fi
# Tmux
2023-10-07 08:43:32 +00:00
ln -sfn "$HOME/dev/dotfiles/tmux.conf" "$HOME/.tmux.conf"
# Vim
2023-10-07 08:43:32 +00:00
mkdir -p "$HOME/.vim/pack/git-plugins/{opt,start}"
ln -sfn "$HOME/dev/dotfiles/vimrc" "$HOME/.vimrc"
ln -sfn "$HOME/dev/dotfiles/vim/after" "$HOME/.vim/after"
ln -sfn "$HOME/dev/dotfiles/vim/after" "$HOME/.vim/queries"
ln -sfn "$HOME/dev/dotfiles/vim/after" "$HOME/.vim/lua"
# Git
2023-10-07 08:43:32 +00:00
ln -sfn "$HOME/dev/dotfiles/gitconfig" "$HOME/.gitconfig"
mkdir -p "$HOME/.config/git"
ln -sfn "$HOME/dev/dotfiles/gitignore" "$HOME/.config/git/ignore"
# Alacritty
2023-10-07 08:43:32 +00:00
if [ "$(uname -s)" = "Darwin" ]; then
alacrittyconfig="$HOME/dev/dotfiles/alacritty.macos.yml"
else
alacrittyconfig="$HOME/dev/dotfiles/alacritty.yml"
fi
2023-10-07 08:43:32 +00:00
ln -sfn "$alacrittyconfig" "$HOME/.config/alacritty.yml"
echo "Done"