aboutsummaryrefslogtreecommitdiff
path: root/vp
diff options
context:
space:
mode:
Diffstat (limited to 'vp')
-rwxr-xr-xvp17
1 files changed, 16 insertions, 1 deletions
diff --git a/vp b/vp
index 366a1b6..88bfdf9 100755
--- a/vp
+++ b/vp
@@ -1,2 +1,17 @@
#!/bin/sh
-exec vi +':so /usr/local/etc/vprc' "$@" `mktemp`
+
+VPIN=
+if [ ! -t 0 ]; then
+ VPIN=`mktemp`
+ cat > "$VPIN"
+fi
+export VPIN
+
+f=`mktemp`
+</dev/tty >/dev/tty vi +':so /usr/local/etc/vprc' "$@" "$f"
+[ "$(wc -c "$f" | awk '{print $1}')" -eq 0 ] && rm "$f"
+
+if [ ! -z "$VPIN" ]; then
+ cat "$VPIN"
+ rm "$VPIN"
+fi