2019-04-21 11:42:15 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
2019-05-22 14:11:02 +00:00
|
|
|
DOTFILES_PATH="${0:a:h}"
|
|
|
|
|
2019-04-21 11:42:15 +00:00
|
|
|
install_dotfile() {
|
|
|
|
local dest="$1"
|
2019-05-20 21:30:50 +00:00
|
|
|
local contents="$2"
|
2019-04-21 11:42:15 +00:00
|
|
|
|
|
|
|
if [[ -f "$dest" ]]; then
|
|
|
|
mv -vi "$dest" "$dest.dmitmel-dotfiles-backup"
|
|
|
|
fi
|
|
|
|
|
2019-08-25 07:54:43 +00:00
|
|
|
mkdir -pv "${dest:h}"
|
|
|
|
echo "installing dotfile '$dest'"
|
2019-05-20 21:30:50 +00:00
|
|
|
echo "$contents" > "$dest"
|
2019-04-21 11:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# ZSH
|
2019-06-02 12:11:40 +00:00
|
|
|
for file_name in zshrc; do
|
|
|
|
file_path="$DOTFILES_PATH/zsh/$file_name"
|
|
|
|
install_dotfile "$HOME/.$file_name" "source ${(q)file_path}"
|
2019-04-21 11:42:15 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Neovim
|
2019-06-02 12:11:40 +00:00
|
|
|
for file_name in {init,ginit}.vim; do
|
|
|
|
file_path="$DOTFILES_PATH/nvim/$file_name"
|
|
|
|
install_dotfile "$HOME/.config/nvim/$file_name" "source ${(q)file_path}"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Kitty
|
|
|
|
file_name=kitty.conf
|
2019-06-09 16:04:17 +00:00
|
|
|
file_path="$DOTFILES_PATH/kitty/$file_name"
|
2019-06-02 12:11:40 +00:00
|
|
|
install_dotfile "$HOME/.config/kitty/$file_name" "include ${(q)file_path}"
|
2019-08-25 07:54:43 +00:00
|
|
|
|
|
|
|
# tmux
|
|
|
|
file_name=tmux.conf
|
|
|
|
file_path="$DOTFILES_PATH/tmux/$file_name"
|
|
|
|
install_dotfile "$HOME/.$file_name" "source-file ${(q)file_path}"
|