Files
dotfiles/bin/gv
2020-10-07 13:21:52 +01:00

20 lines
578 B
Bash
Executable File

#!/bin/sh
PARENT_REPO=$(find-parent-repo)
if [ "$PARENT_REPO" == "" ] ; then
echo "You aren't in a git repository. Can't find an automatic name."
exit 1
fi
REPO_NAME=$(basename $PARENT_REPO)
if [ -r ${PARENT_REPO}/Session.vim ] ; then
echo "Found ${PARENT_REPO}/Session.vim"
if [ "$1" != "nosession" ] ; then
echo "Restoring session"
SESSION="-S ${PARENT_REPO}/Session.vim"
else
echo "nosession given, not restoring."
shift
fi
fi
(cd $PARENT_REPO && gvim --servername $REPO_NAME $SESSION --remote "$*") ; cd $CURRENT_DIR