From: Stefan Huber Date: Tue, 23 Oct 2018 18:07:38 +0000 (+0200) Subject: Let install.sh create backups X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=5a6540e9d77613486a8edd03af3baf36d41f2755;p=vimconf.git Let install.sh create backups --- diff --git a/install.sh b/install.sh index d2d300a..aca030c 100755 --- a/install.sh +++ b/install.sh @@ -39,12 +39,30 @@ check_requirements() check_py3 neovim } +backup() { + if [ -e $1 ]; then + echo " Move $1" + mv $1 $2/ + fi +} + install() { + BACKUPDIR=$(mktemp -d "$HOME/.vim-old-XXXXXXXX") + echo "Move old vim files to $BACKUPDIR" + backup $HOME/.viminfo $BACKUPDIR + backup $HOME/.vimrc $BACKUPDIR + backup $HOME/.gvimrc $BACKUPDIR + backup $HOME/.config/nvim $BACKUPDIR + echo "Installing files." - touch $HOME/.viminfo + echo "# Empty" > $HOME/.viminfo ln -s $HOME/.vim/init.vim $HOME/.vimrc ln -s $HOME/.vim/gvimrc $HOME/.gvimrc ln -s $HOME/.vim $HOME/.config/nvim + + echo "" + echo "vim-startify may complain about invalid viminfo file. It will" + echo "disappear once you opened the first file." }