Skip to content

Instantly share code, notes, and snippets.

@gmhawash
Created March 5, 2013 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmhawash/5095015 to your computer and use it in GitHub Desktop.
Save gmhawash/5095015 to your computer and use it in GitHub Desktop.
Script to install vim plugins
#!/bin/bash
echo "Installing ctags"
sudo apt-get install exuberant-ctags
DOTVIM="$HOME/.vim"
JQUERY=12276
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"
git clone git://github.com/$gh_user/$repo.git
fi
}
echo "Creating .vim folders if necessary"
mkdir -p $DOTVIM/{autoload,bundle,ftdetect,syntax}
cd $DOTVIM/bundle/
tpope_repos=(rails haml git cucumber fugitive surround unimpaired abolish repeat markdown endwise)
for r in ${tpope_repos[*]}; do
repo="vim-$r"
get_repo "tpope" $repo
done
get_repo "scrooloose" "nerdtree"
get_repo "scrooloose" "syntastic"
get_repo "jc00ke" "nerdcommenter"
get_repo "msanders" "snipmate.vim"
get_repo "vim-ruby" "vim-ruby"
get_repo "jc00ke" "taglist.vim"
get_repo "mileszs" "ack.vim"
get_repo "tsaleh" "vim-supertab"
get_repo "tsaleh" "vim-align"
get_repo "tsaleh" "vim-matchit"
get_repo "kana" "vim-textobj-user"
get_repo "nelstrom" "vim-textobj-rubyblock"
get_repo "michaeljsmith" "vim-indent-object"
get_repo "motemen" "git-vim"
get_repo "adamlowe" "vim-slurper"
get_repo "kchmck" "vim-coffee-script"
get_repo "int3" "vim-extradite"
get_repo "altercation" "vim-colors-solarized"
get_repo "juvenn" "mustache.vim"
echo "Installing jQuery"
cd $DOTVIM
curl http://www.vim.org/scripts/download_script.php?src_id=$JQUERY -o "syntax/jquery.vim"
curl https://raw.github.com/jc00ke/Gemfile.vim/master/syntax/Gemfile.vim -o "syntax/Gemfile.vim"
curl https://raw.github.com/jc00ke/Gemfile.vim/master/ftdetect/Gemfile.vim -o "ftdetect/Gemfile.vim"
cd $DOTVIM/autoload
echo "Fetching latest pathogen.vim"
rm pathogen.vim
curl -O https://raw.github.com/tpope/vim-pathogen/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
ct=`curl -s https://wincent.com/products/command-t | grep releases | head -1 | cut -d\" -f2`
cd /tmp
vba=$( echo "$ct" | ruby -ruri -e 'puts File.basename(gets.chomp)' )
echo "***********************************************************"
echo "Would you like to download and install Command-T: $vba? If so, type yes. Anything else will bypass."
echo "***********************************************************"
read answer
if [ "$answer" == 'yes' ]
then
echo "Installing Command-T plugin"
curl -O $ct
echo ""
echo ""
echo "***********************************************************"
echo "Vim will start, then :so %"
echo "When the script is done it'll compile the ruby extension"
echo "***********************************************************"
sleep 3
vim /tmp/$vba
sleep 3
cd ~/.vim/ruby/command-t
ruby extconf.rb
make
else
echo "Skipping install, just run this script again if you want it"
echo "***********************************************************"
fi
[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment