diff --git a/get.vimfiles.sh b/get.vimfiles.sh index c67468714..7b6867a2b 100755 --- a/get.vimfiles.sh +++ b/get.vimfiles.sh @@ -7,12 +7,10 @@ # # curl https://raw.github.com/coderifous/dotfiles/master/get.vimfiles.sh | sh -# If you have a fork, change this variable. The other ones should be fine. -REPO_OWNER="coderifous" - - REPO_NAME="dotfiles" -GIT_REPO_URL="git://github.com/$REPO_OWNER/$REPO_NAME.git" +# Replace the hostname, username and repository name as required to use your +# own fork instead of Coderifous's. +GIT_REPO_URL="git@github.com:coderifous/$REPO_NAME.git" echo -e "\033[32mDownloading repository." echo -e "\033[0m" @@ -22,25 +20,46 @@ git clone $GIT_REPO_URL echo echo -e "\033[32mUpdating submodules." echo -e "\033[0m" - +echo "REPO_NAME = $REPO_NAME" cd $REPO_NAME git submodule update --init +backup_file() { + if [ -e $1 ] || [ -L $1 ]; + then + bakext=".bak" + bakfile=$1$bakext + echo -e "\033[32mBacking up \"$1\" to \"$bakfile\"." + echo -e "\033[0m" + mv $1 $bakfile + fi +} + echo echo -e "\033[32mCreating dotfile links in home dir." echo -e "\033[0m" VIMHOME=`pwd`"/vim" -ln -s $VIMHOME ~/.vim -ln -s ~/.vim/vimrc ~/.vimrc +backup_file ~/.vim +ln -s $VIMHOME ~/.vim + +backup_file ~/.vimrc +ln -s ~/.vim/vimrc ~/.vimrc + +backup_file ~/.gvimrc ln -s ~/.vim/gvimrc ~/.gvimrc -echo -echo -e "\033[32mCreating ~/.vim_tmp: where vim is configured to store temporary files." -echo -e "\033[0m" -mkdir ~/.vim_tmp +if [ ! -d ~/.vim_tmp ]; +then + echo + echo -e "\033[32mCreating ~/.vim_tmp: where vim is configured to store temporary files." + echo -e "\033[0m" + mkdir ~/.vim_tmp +fi + +#end echo echo -e "\033[32mVim dotfiles installed!"