diff --git a/viper b/viper index 3333a3f..96bbf26 100755 --- a/viper +++ b/viper @@ -1,10 +1,12 @@ #!/bin/bash -# (c) https://stackoverflow.com/questions/10686183/pipe-vim-buffer-to-stdout/10686830#10686830 - TMPFILE=$(mktemp /tmp/viper.XXXXXXXX) cat > "$TMPFILE" $EDITOR "$@" "$TMPFILE" < /dev/tty > /dev/tty -cat "$TMPFILE" + +if [ "$?" -eq 0 ]; then + cat "$TMPFILE" +fi + \rm -f "$TMPFILE"