2012-07-02 19:26:56 +00:00
|
|
|
############################
|
|
|
|
# Vim Settings Setup script by ViViDboarder (Ian)
|
|
|
|
# http://github.com/ViViDboarder/Vim-Settings
|
|
|
|
############################
|
2012-03-29 03:18:33 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2012-07-31 15:54:33 +00:00
|
|
|
# Try to load .bashrc to load rvm functions
|
|
|
|
if [ -f ~/.bashrc ]; then
|
|
|
|
. ~/.bashrc
|
|
|
|
fi
|
|
|
|
|
2012-03-29 03:18:33 +00:00
|
|
|
# Get current directory for future use in links
|
2012-10-23 14:52:47 +00:00
|
|
|
VIM_SYNC_DIR=$(dirname $0)
|
|
|
|
cd $VIM_SYNC_DIR
|
|
|
|
VIM_SYNC_DIR=$(pwd)
|
2012-03-29 03:18:33 +00:00
|
|
|
|
2012-07-02 19:26:56 +00:00
|
|
|
# Verify git is installed (although needed to checkout
|
|
|
|
command -v git >/dev/null 2>&1 || {
|
|
|
|
echo "Error: git required for install";
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
2012-07-03 14:13:15 +00:00
|
|
|
# Clone vundle if not done already
|
|
|
|
if [ ! -d ~/.vim/bundle/vundle ]; then
|
|
|
|
echo "Installing vundle"
|
|
|
|
mkdir -p ~/.vim/bundle
|
|
|
|
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
|
|
|
|
fi
|
2012-07-02 17:25:36 +00:00
|
|
|
|
|
|
|
# Make backup and tmp dirs
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Building temp and backup dirs"
|
2012-07-02 17:25:36 +00:00
|
|
|
mkdir -p ~/.vim/backup
|
|
|
|
mkdir -p ~/.vim/tmp
|
|
|
|
mkdir -p ~/.vim/doc
|
|
|
|
|
2012-03-29 03:18:33 +00:00
|
|
|
# If a .vimrc_sync doesn't exist, link it
|
|
|
|
if [[ ! ( -f ~/.vimrc_sync ) ]]; then
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Linking sync'd vimrc"
|
2012-03-29 03:18:33 +00:00
|
|
|
ln -s $VIM_SYNC_DIR/vim/dot_vimrc ~/.vimrc_sync
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If a .vim_drpobox dir doesn't exist, link it
|
|
|
|
if [[ ! ( -d ~/.vim_sync ) ]]; then
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Linking sync'd vim runtime"
|
2012-03-29 03:18:33 +00:00
|
|
|
ln -s $VIM_SYNC_DIR/vim/dot_vim ~/.vim_sync
|
|
|
|
fi
|
|
|
|
|
|
|
|
# if there is no .vimrc file already, make a blank one
|
|
|
|
if [[ ( ! -f ~/.vimrc ) ]]; then
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "No ~/.vimrc found, creating one"
|
2012-03-29 03:18:33 +00:00
|
|
|
touch ~/.vimrc
|
|
|
|
fi
|
|
|
|
|
|
|
|
# if not already sourcing the synced version, source it
|
2012-07-02 19:26:56 +00:00
|
|
|
if ! ( grep -q 'source ~/.vimrc_sync' ~/.vimrc ); then
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Source sync'd vimrc in vimrc"
|
2012-03-29 03:18:33 +00:00
|
|
|
echo '' >> ~/.vimrc
|
|
|
|
echo '"import vimrc from synced' >> ~/.vimrc
|
|
|
|
echo 'source ~/.vimrc_sync' >> ~/.vimrc
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ( grep -q 'set runtimepath+=$HOME/.vim_sync' ~/.vimrc ); then
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Add sync'd vim dir to runtime"
|
2012-03-29 03:18:33 +00:00
|
|
|
echo '' >> ~/.vimrc
|
|
|
|
echo '"add vim directory from synced' >> ~/.vimrc
|
|
|
|
echo 'set runtimepath+=$HOME/.vim_sync' >> ~/.vimrc
|
|
|
|
fi
|
|
|
|
|
2012-07-02 17:25:36 +00:00
|
|
|
# Install all bundles
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Install all bundles"
|
2012-07-02 17:25:36 +00:00
|
|
|
vim +BundleInstall! +qall
|
|
|
|
|
2012-07-02 19:26:56 +00:00
|
|
|
# Compile CommandT if possible
|
|
|
|
# See if ruby is installed
|
|
|
|
if command -v ruby >/dev/null 2>&1; then
|
|
|
|
# Make sure GCC is installed
|
|
|
|
if command -v gcc >/dev/null 2>&1; then
|
|
|
|
# Use system ruby
|
|
|
|
command -v rvm >/dev/null 2>&1 && { rvm use system; }
|
2012-07-03 14:13:15 +00:00
|
|
|
echo "Compile Command T's C extension"
|
2012-07-02 19:26:56 +00:00
|
|
|
cd ~/.vim/bundle/Command-T/ruby/command-t
|
|
|
|
ruby extconf.rb
|
|
|
|
make
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-07-03 14:13:15 +00:00
|
|
|
# Display warning methods related to Command T
|
2012-07-02 19:26:56 +00:00
|
|
|
vim --version | grep -q '\+ruby' || { echo "Warning: Default vim does not include ruby as needed for Command T"; }
|
|
|
|
command -v ruby >/dev/null 2>&1 || { echo "Warning: ruby required for Command T"; }
|
|
|
|
command -v gcc >/dev/null 2>&1 || { echo "Warning: gcc required for Command T"; }
|
|
|
|
|
2012-03-29 03:18:33 +00:00
|
|
|
# Execute vim's update of the helptags
|
2012-07-02 17:25:36 +00:00
|
|
|
vim +"helptags ~/.vim/doc" +"q"
|
2012-03-29 03:18:33 +00:00
|
|
|
|
2012-07-02 19:26:56 +00:00
|
|
|
# Warn if ctags does not exist
|
|
|
|
command -v ctags >/dev/null 2>&1 || { echo "Warning: ctags required for Tag List
|
|
|
|
--- Debian: apt-get install ctags
|
|
|
|
--- OSX (MacPorts): port install ctags"; }
|
2012-03-29 03:18:33 +00:00
|
|
|
|