darkcloud-vimconfig/update
Kevin a7e95b25ac Tweaked the update script to drop the user variables from vimrc into
vimrc.user when it's created. a new user-based config file can be used
to specify the location of the project folder without altering vimrc, if
it's a symlink and bound to bump into conflicts as changes are made. The
README was updated to reflect a few of the recent changes. The tagbar
now outputs to the lightline statusline if there's anything to report.
A new variable was added to choose whether to always start with the
tagbar enabled if the format is compatible, or use the older behaviour,
where it would only appear when triggered. The default is to enable it 24/7.
2014-04-08 03:39:10 -04:00

34 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# work from the base directory of the repository
cd "${0%/*}"
# create the user vimrc file in the directory if it doesn't already exist
if [ ! -e vim/vimrc.user ]; then
if [ -d vim ] && [ -w vim ]; then
echo -e '"Syntax Checking Autostart: (1:start toggled on | 0: start toggled off)\nlet g:autostartchecker=1\n' >> vim/vimrc.user
echo -e '"Vim Starts With The Tagbar Open: (1:start open | 0:start closed)\nlet g:autostarttagbar=1\n' >> vim/vimrc.user
echo -e '"Powerline Font Support: (1:enabled | 0:disabled)\nlet g:powerlinefonts=1\n' >> vim/vimrc.user
echo -e '"GVim Font Selection: (term font set by terminal)\nset guifont=Droid\ Sans\ Mono\ 12' >> vim/vimrc.user
fi
fi
# update the repository and submodules
git pull origin
git submodule update --init --recursive
# delete any submodule no longer in the repository
[[ -f .gitmodules ]] && for each in vim/bundle/*; do
if [ -d "$each" ]; then
if [ -f "${each}/.git" ]; then
FILE=$(echo $each | grep -o -e "[^\/]*$")
[[ `cat .gitmodules | grep "path = " | grep -o -e "[^\/]*$" | grep -c "${FILE}"` = 0 ]] && (rm -rf "${each}" && echo "Deleted: ${each}" || (echo -e "\033[01;31mWARNING\033[00m: '${each}' was removed upstream but couldn't be deleted here.\n\nPlease delete ${each} manually."; exit 1))
fi
fi
done
# update the help text for any new/changed pathogen plugin
[[ `type -P vim` ]] && vim -c "Helptags|qa!" &>/dev/null 2>&1
# exit cleanly
exit 0