Skip to content

Instantly share code, notes, and snippets.

@jeetsukumaran
Created July 10, 2011 06:09
Show Gist options
  • Save jeetsukumaran/1074321 to your computer and use it in GitHub Desktop.
Save jeetsukumaran/1074321 to your computer and use it in GitHub Desktop.
Create an Archive of Your Vim Configuration/Setup for Deployment on Other Machines
#! /bin/bash
function usage {
echo "`basename $0` [OPTIONS] [OUTPUT-PREFIX]"
echo "Archives Vim installation."
echo " "
echo "Options:"
echo " --windows ... build distributable for MS Windows system"
echo " -h|--help ... show help"
exit 1
}
WINDOWS_TARGET=0
while [ -n $1 ]; do
case $1 in
--windows)
WINDOWS_TARGET=1
shift
;;
-h|--help)
usage
;;
*)
break
;;
esac
done
if [[ -n $1 ]]
then
OUTPUT_PREFIX="$1"
else
OUTPUT_PREFIX="$(pwd)/vim-conf"
fi
TEMPDIR=$(mktemp -d /tmp/vimmakedist.XXXXXX) || exit 1
cd $HOME
tar -c -f $TEMPDIR/vimfiles.tar --exclude '*/.git*' -h .vimrc .vim/
cd $TEMPDIR
tar xvf vimfiles.tar
rm vimfiles.tar
if [[ $WINDOWS_TARGET == 1 ]]
then
mv .vimrc _vimrc
mv .vim/ vimfiles/
zip -r $OUTPUT_PREFIX.zip _vimrc vimfiles
else
tar cvzf $OUTPUT_PREFIX.tar.gz .vimrc .vim/
fi
cd ..
rm -r $TEMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment