Skip to content

Instantly share code, notes, and snippets.

@alan
Forked from jc00ke/install_vim_files.sh
Created March 28, 2010 17:22
Show Gist options
  • Save alan/346887 to your computer and use it in GitHub Desktop.
Save alan/346887 to your computer and use it in GitHub Desktop.
#!/bin/bash
DOTVIM="/Users/`whoami`/.vim"
JQUERY=12107
if [ ! -e `which git` ]
then
echo "You need git. Try running install_git"
exit 0
fi
if [ ! -d $DOTVIM ]
then
mkdir $DOTVIM
fi
get_repo() {
gh_user=$1
repo=$2
echo "Checking $repo"
if [ -d "$DOTVIM/bundle/$repo/" ]
then
echo "Pulling latest from $repo"
cd $DOTVIM/bundle/$repo
git pull origin master
cd ..
else
echo "Cloning repo for $repo"
cd $DOTVIM/bundle
git clone git://github.com/$gh_user/$repo.git
fi
}
echo "Creating .vim folders if necessary"
cd $DOTVIM/bundle/
mkdir -p $DOTVIM/{autoload,bundle}
tpope_repos=(rails haml git cucumber markdown)
for r in ${tpope_repos[*]}; do
repo="vim-$r"
get_repo "tpope" $repo
done
echo "Installing NERDTree"
get_repo "scrooloose" "nerdtree"
echo "Installing NERDCommenter"
get_repo "scrooloose" "nerdcommenter"
echo "Installing snipMate"
get_repo "msanders" "snipmate.vim"
echo "Installing vim-ruby"
get_repo "vim-ruby" "vim-ruby"
echo "Installing mustache.vim"
get_repo "jc00ke" "mustache.vim"
echo "Installing jQuery"
mkdir -p jquery/syntax
wget -c -O jquery/syntax/jquery.vim http://www.vim.org/scripts/download_script.php?src_id=$JQUERY
cd $DOTVIM/autoload
echo "Fetching latest pathogen.vim"
rm pathogen.vim
wget http://github.com/tpope/vim-pathogen/raw/master/autoload/pathogen.vim
echo "Checking to see if pathogen has already been added to .vimrc"
pathogen_cmd="call pathogen#runtime_append_all_bundles()"
contains=`grep "$pathogen_cmd" ~/.vimrc | wc -l`
if [ $contains == 0 ]
then
echo "Hasn't been added, adding now."
echo "$pathogen_cmd" >> ~/.vimrc
else
echo "It was already added. Good to go"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment