dotfiles/setup.sh

107 lines
3 KiB
Bash
Raw Normal View History

2013-09-04 14:03:45 -07:00
#!/usr/bin/env zsh
2011-05-03 21:53:50 -07:00
dfdir=$(cd "$(dirname "$0")" && pwd)
2012-04-23 15:02:41 -07:00
sys=`uname -s | tr A-Z a-z`
2011-05-03 21:53:50 -07:00
# Vim bundles
typeset -A vimbundles
2012-09-28 12:45:57 -07:00
# Commented out Vim plugin repos, 'cause I'm not using them...
# blackboard "https://github.com/nelstrom/vim-blackboard.git" \
# fugitive "https://github.com/tpope/vim-fugitive.git" \
2014-02-11 16:12:17 -08:00
# command-t "https://github.com/wincent/Command-T.git" \
#
# dash "https://github.com/rizzatti/dash.vim.git"
# funcoo "https://github.com/rizzatti/funcoo.vim.git" \
# gundo "https://github.com/sjl/gundo.vim.git" \
# mw-utils "https://github.com/MarcWeber/vim-addon-mw-utils.git" \
# repeat "https://github.com/tpope/vim-repeat" \
# snipmate "https://github.com/garbas/vim-snipmate.git" \
# snipmate-snippets "https://github.com/honza/vim-snippets.git" \
# snipmate-zope "https://github.com/zedr/zope-snipmate-bundle.git" \
# solarized "https://github.com/altercation/vim-colors-solarized.git" \
# speeddating "https://github.com/tpope/vim-speeddating.git" \
# surround "https://github.com/tpope/vim-surround.git" \
# tlib "https://github.com/tomtom/tlib_vim.git" \
# unimpaired "https://github.com/tpope/vim-unimpaired.git" \
vimbundles=( \
Vundle.vim "https://github.com/gmarik/Vundle.vim.git" \
)
2014-09-02 09:37:45 -07:00
function link
{
local dest
if [[ "$2" == '' ]]; then
dest="$HOME/.$dotfile"
else
dest="$2"
fi
if [[ ! -e "$dest" ]]; then
action='Linking'
ln -fs "$1" "$dest"
else
action='Skipping'
fi
printf " %8s: %s\n" $action $dest
}
print -P "%BSymlinking config files%b"
2013-09-04 14:03:45 -07:00
for dotfile in `ls $dfdir`; do
2012-04-17 22:37:39 -07:00
# metafiles; don't link them
2013-04-14 11:17:10 -07:00
[[ $dotfile = 'setup.sh' ]] && continue
[[ $dotfile = 'README.md' ]] && continue
2014-02-11 16:12:17 -08:00
[[ $dotfile = 'py' ]] && continue
2014-09-02 09:37:45 -07:00
[[ $dotfile = 'bin' ]] && continue
2014-09-02 09:37:45 -07:00
link "$dfdir/$dotfile"
done
2014-09-02 09:37:45 -07:00
link "$dfdir/bin" "$HOME/bin"
echo "touch $HOME/.hushlogin"
touch "$HOME/.hushlogin"
2011-05-03 21:53:50 -07:00
# Initialize submodules
print -P "%BFetching Vim modules%b"
cd "$dfdir/vim/bundle"
for module in ${(k)vimbundles}; do
echo -n " $module"
2013-09-04 14:03:45 -07:00
if [[ -d $module ]]; then
# result='skipped'
else
git clone ${vimbundles[$module]} $module 1>/dev/null 2>&1
if [[ $? -eq 0 ]]; then
result='done'
else
result='failed'
fi
fi
spaces=''
filler=$(($COLUMNS - ${#module} - ${#result} - 4))
for (( i=0; $i < $filler; i++ )); do spaces="$spaces "; done
if [[ $result == 'skipped' ]]; then
color='yellow'
elif [[ $result == 'failed' ]]; then
color='red'
elif [[ $result == 'done' ]]; then
color='green'
fi
print -P "$spaces%F{$color}$result%f"
done
2011-05-03 21:53:50 -07:00
if [[ -d "$dfdir/vim/bundle/command-t/ruby/command-t" ]]; then
print -P "%BSetting up command-t%b"
cd "$dfdir/vim/bundle/command-t/ruby/command-t"
ruby extconf.rb
make
fi
2012-08-08 10:18:46 -07:00
2011-05-03 21:53:50 -07:00
exit 0