fix installation script

This commit is contained in:
Dmytro Meleshko 2019-05-21 00:30:50 +03:00
parent f46e58fd3a
commit 4fb5bc69ff

View file

@ -2,28 +2,25 @@
install_dotfile() {
local dest="$1"
local contents="$2"
if [[ -f "$dest" ]]; then
mv -vi "$dest" "$dest.dmitmel-dotfiles-backup"
fi
mkdir -p "${dest:h}"
cat > "$dest"
echo "$contents" > "$dest"
}
# ZSH
for zsh_file_name in zshrc; do
install_dotfile "$HOME/.$zsh_file_name" <<EOF
install_dotfile "$HOME/.$zsh_file_name" '
#!/usr/bin/env zsh
source "$PWD/zsh/$zsh_file_name"
EOF
'
done
unset zsh_file_name
# Neovim
install_dotfile ~/.config/nvim/init.vim <<EOF
source $PWD/nvim/init.vim
EOF
install_dotfile ~/.config/nvim/ginit.vim <<EOF
source $PWD/nvim/ginit.vim
EOF
install_dotfile ~/.config/nvim/init.vim 'source $PWD/nvim/init.vim'
install_dotfile ~/.config/nvim/ginit.vim 'source $PWD/nvim/ginit.vim'