bin: add gv and find-parent-repo
This commit is contained in:
15
bin/find-parent-repo
Executable file
15
bin/find-parent-repo
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
TESTDIR=$(realpath .)
|
||||
FOUND=0
|
||||
while [ "$TESTDIR" != "/" ]
|
||||
do
|
||||
if [ -d $TESTDIR/.git ] ; then
|
||||
FOUND=1
|
||||
break
|
||||
fi
|
||||
TESTDIR="$TESTDIR/.."
|
||||
TESTDIR=$(realpath $TESTDIR)
|
||||
done
|
||||
if [ $FOUND == 1 ] ; then
|
||||
echo $TESTDIR
|
||||
fi
|
||||
19
bin/gv
Executable file
19
bin/gv
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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"
|
||||
shift
|
||||
else
|
||||
echo "nosession given, not restoring."
|
||||
fi
|
||||
fi
|
||||
|
||||
(cd $PARENT_REPO && gvim --servername $REPO_NAME $SESSION --remote "$*") ; cd $CURRENT_DIR
|
||||
Reference in New Issue
Block a user