2012-04-11 09:54:43 -07:00
|
|
|
#!/bin/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
|
|
|
|
2012-08-08 10:10:57 -07:00
|
|
|
# Vim bundles
|
|
|
|
typeset -A vimbundles
|
|
|
|
vimbundles=( \
|
|
|
|
blackboard "https://github.com/nelstrom/vim-blackboard.git" \
|
|
|
|
command-t "https://github.com/wincent/Command-T.git" \
|
|
|
|
fugitive "https://github.com/tpope/vim-fugitive.git" \
|
|
|
|
gundo "https://github.com/sjl/gundo.vim.git" \
|
|
|
|
repeat "https://github.com/tpope/vim-repeat" \
|
|
|
|
snipmate "https://github.com/msanders/snipmate.vim.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" \
|
|
|
|
unimpaired "https://github.com/tpope/vim-unimpaired.git" \
|
|
|
|
)
|
|
|
|
|
2012-04-11 09:54:43 -07:00
|
|
|
print -P "%BSymlinking config files%b"
|
2012-04-23 15:02:41 -07:00
|
|
|
for dotfile in `ls $dfdir`
|
2012-04-11 09:54:43 -07:00
|
|
|
do
|
2012-04-17 22:37:39 -07:00
|
|
|
# metafiles; don't link them
|
2012-04-11 09:54:43 -07:00
|
|
|
[ $dotfile = 'setup.sh' ] && continue
|
2012-04-17 22:37:39 -07:00
|
|
|
[ $dotfile = 'README.md' ] && continue
|
2012-04-11 09:54:43 -07:00
|
|
|
|
|
|
|
local dest="$HOME/.$dotfile"
|
|
|
|
local action='skipped'
|
|
|
|
|
|
|
|
if [[ ! -L "$dest" ]]; then
|
|
|
|
action='linked'
|
|
|
|
else
|
|
|
|
action='skipped'
|
|
|
|
fi
|
|
|
|
filler=$(($COLUMNS - ${#dest} - ${#action} - 4))
|
|
|
|
spaces=''
|
2012-08-08 10:10:57 -07:00
|
|
|
for (( i=0; $i < $filler; i++ )); do spaces="$spaces "; done
|
2012-04-11 09:54:43 -07:00
|
|
|
|
2012-08-08 10:16:12 -07:00
|
|
|
echo -n " $dest"
|
|
|
|
if [[ $action == 'linked' ]]; then
|
2012-04-11 09:54:43 -07:00
|
|
|
ln -fs "$dfdir/$dotfile" "$dest"
|
2012-08-08 10:16:12 -07:00
|
|
|
action="%F{green}$action%f"
|
|
|
|
elif [[ $action == 'skipped' ]]; then
|
2012-04-11 09:54:43 -07:00
|
|
|
action="%F{yellow}$action%f"
|
|
|
|
else
|
2012-08-08 10:16:12 -07:00
|
|
|
action="%F{red}red%f"
|
2012-04-11 09:54:43 -07:00
|
|
|
fi
|
2012-08-08 10:16:12 -07:00
|
|
|
print -P "$spaces$action"
|
2012-04-11 09:54:43 -07:00
|
|
|
done
|
|
|
|
|
|
|
|
echo "touch $HOME/.hushlogin"
|
2012-02-24 21:54:52 -08:00
|
|
|
touch "$HOME/.hushlogin"
|
2011-05-03 21:53:50 -07:00
|
|
|
|
2012-04-11 09:54:43 -07:00
|
|
|
# Initialize submodules
|
2012-08-08 10:10:57 -07:00
|
|
|
print -P "%BFetching Vim modules%b"
|
|
|
|
cd "$dfdir/vim/bundle"
|
|
|
|
for module in ${(k)vimbundles}; do
|
|
|
|
echo -n " $module"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
exit 0
|