Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 95 lines (81 sloc) 1.773 kB
#!/bin/bash
set -e
help () {
cat<<EOF
Usage: quick-vim [install|uninstall|upgrade|help]
Commands:
install installs from the git repo
uninstall restores original system vim config
upgrade clobbers existing setup and installs fresh from git
help print this msg
EOF
}
# backs default home vim up
backup () {
if [ -e ./backup ]
then
echo 'skipping backup'
else
mkdir -p ./backup
if [ -e ~/.vimrc ]
then
mv ~/.vimrc ./backup/.vimrc
fi
if [ -e ~/.vim ]
then
mv ~/.vim ./backup/.vim
fi
fi
}
# copy in pathogen and then clone in bundles
install () {
backup
# copy in vimrc and pathogen
cp ./vimrc ~/.vimrc
cp -r ./vim ~/.vim
# add in bundles from bundle.txt
mkdir -p ~/.vim/bundle
bundles=$(cat ./bundles.txt)
cd ~/.vim/bundle
for repo in $bundles; do
git clone $repo
done
}
# if backup exists clobbers home vim and copies in backup
uninstall () {
if [ -e ./backup ]
then
rm ~/.vimrc
rm -rf ~/.vim
if [ -e ./backup/.vimrc ]
then
mv ./backup/.vimrc ~/.vimrc
fi
if [ -e ./backup/.vim ]
then
mv ./backup/.vim ~/.vim
fi
rm -rf ./backup
fi
}
# kills everything, pulls latest from git, installs it
upgrade () {
uninstall
git pull
install
}
# fucking cryptic bash, test for a valid arg and execute it if so; otherwise show the help
if [ "$1" != "" ]; then
wl=(install uninstall upgrade help)
for i in "${wl[@]}"
do
if [ "$i" == "$1" ]
then
$1
exit 0
fi
done
fi
# show a flailer some help
help
exit 0
Jump to Line
Something went wrong with that request. Please try again.