From 0864900cfd5201924f00b20c479a89f94d824d41 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 23 Jul 2018 08:39:44 -0700 Subject: 4388 Abort relayout if we exit with `:cquit`. --- relayout | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'relayout') diff --git a/relayout b/relayout index 921fda9c..8ea48920 100755 --- a/relayout +++ b/relayout @@ -5,6 +5,8 @@ # Assumes there's only ever one file with any numeric prefix. If you move # 003trace.test.cc you might need to do some manual patch-up. +set -e + if [[ $# -eq 0 && `git diff HEAD |wc -l` -gt 0 ]] then echo "Uncommitted changes" @@ -24,7 +26,6 @@ index=0 ls [0-9]* |grep -v "trace.test" |sort -n | while read file do - echo $file >&2 while [[ $file != `printf "%03d" $index`* ]] do echo @@ -51,6 +52,7 @@ cat .layout | newfile=`printf "%03d" $index``root $file` if [[ $newfile != $file ]] then + echo git mv $file $newfile git mv $file $newfile fi fi @@ -58,3 +60,6 @@ cat .layout | done rm .layout + +# Scenarios considered: +# Don't redo the layout if Vim exits with error. -- cgit 1.4.1-2-gfad0