I've had this in [my own dotfiles] for a while now, and really like having the separation of what I consider to be code/configuration from what to me feels more like a Gemfile, in that it lists out all of the external dependencies in a single place. [my own dotfiles](https://github.com/calebthompson/dotfiles/blob/master/vim/vimrc.bundles.symlink) * Awesomer vundle integration: * Refactor .vimrc and .vimrc.bundles to support standalone BundleInstall. * Install vim bundles as part of install.sh without sourcing the normal vimrc, which prevents error messages from uninstalled plugins referenced in the main vimrc.
38 lines
1.1 KiB
Bash
Executable file
38 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
cutstring="DO NOT EDIT BELOW THIS LINE"
|
|
|
|
for name in *; do
|
|
target="$HOME/.$name"
|
|
if [ -e "$target" ]; then
|
|
if [ ! -L "$target" ]; then
|
|
cutline=`grep -n -m1 "$cutstring" "$target" | sed "s/:.*//"`
|
|
if [ -n "$cutline" ]; then
|
|
cutline=$((cutline-1))
|
|
echo "Updating $target"
|
|
head -n $cutline "$target" > update_tmp
|
|
startline=`sed '1!G;h;$!d' "$name" | grep -n -m1 "$cutstring" | sed "s/:.*//"`
|
|
if [ -n "$startline" ]; then
|
|
tail -n $startline "$name" >> update_tmp
|
|
else
|
|
cat "$name" >> update_tmp
|
|
fi
|
|
mv update_tmp "$target"
|
|
else
|
|
echo "WARNING: $target exists but is not a symlink."
|
|
fi
|
|
fi
|
|
else
|
|
if [ "$name" != 'install.sh' ] && [ "$name" != 'README.md' ]; then
|
|
echo "Creating $target"
|
|
if [ -n "$(grep "$cutstring" "$name")" ]; then
|
|
cp "$PWD/$name" "$target"
|
|
else
|
|
ln -s "$PWD/$name" "$target"
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
|
|
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
|
|
vim -u ~/.vimrc.bundles +BundleInstall +qa
|