]> git.sthu.org Git - vimconf.git/commitdiff
Let install.sh create backups
authorStefan Huber <shuber@sthu.org>
Tue, 23 Oct 2018 18:07:38 +0000 (20:07 +0200)
committerStefan Huber <shuber@sthu.org>
Tue, 23 Oct 2018 18:53:16 +0000 (20:53 +0200)
install.sh

index d2d300aeffd913351055fb4df779eb57c26dd1c1..aca030c47ed1d947a297e4527c3792daf89c003d 100755 (executable)
@@ -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."
 }