From d8a3c36c28b040163fafb7d8598f31ccdf820780 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Tue, 1 Nov 2022 13:26:49 +0000 Subject: [PATCH] vim: make session optional --- bin/gv | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/gv b/bin/gv index 2e9a60a..70babf1 100755 --- a/bin/gv +++ b/bin/gv @@ -1,18 +1,23 @@ #!/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 + 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 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 + if [ "$GV_NO_SESSION" != 1 ] ; 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 fi