#!/bin/bash

source common.sh

LOCALVIMRC="$main_dir/dotfiles/vim/init.vim"

VIMRC="/home/$USER/.vimrc"
VIMDIR="/home/$USER/"

CURDATE=$(date +%m%d%Y%H%M%S)

echo $CURDATE

echo Installing VIM

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

if [ -f $VIMRC ];
then
	echo Backing the old config file with the current date
	cp $VIMRC "$VIMRC"."$CURDATE"
	cp $LOCALVIMRC $VIMDIR
	cd $VIMDIR 
	mv $LOCALVIMRC .vimrc
else
	cp $LOCALVIMRC $VIMDIR
	cd $VIMDIR 
	mv $LOCALVIMRC .vimrc
fi
