Skip to content

Added flexibility to get.vimfiles.sh #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Combined variables down to two, per request from coderifous. Couldnt …
…eliminate the separate REPO_NAME variable, because its needed elsewhere. Added ability to back up existing .vim, .vimrc and .gvimrc files before creating symbolic links.
  • Loading branch information
Charles Calvert committed Oct 26, 2011
commit 73636b4fe82a1cf4e9a5e66447629ea387a8972b
46 changes: 31 additions & 15 deletions get.vimfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@
#
# curl https://raw.github.com/coderifous/dotfiles/master/get.vimfiles.sh | sh

# Put your github username on the next line
REPO_OWNER="coderifous"
# REPO_HOST will generally be "github.com", but may be changed to something else
# if you're using a different git hosting service or if you have configured
# an alias in ~/.ssh/config, e.g. because you're using multiple identities.
REPO_HOST="github.com"
# The next line should contain the name of the repository.
REPO_NAME="dotfiles"
GIT_REPO_URL="git@$REPO_HOST:$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="[email protected]:coderifous/$REPO_NAME.git"

echo -e "\033[32mDownloading repository."
echo -e "\033[0m"
Expand All @@ -25,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!"
Expand Down