From d83888df54f7dbe95aca42ce6581f860649b8112 Mon Sep 17 00:00:00 2001 From: John Ellson <ellson@research.att.com> Date: Thu, 24 Oct 2013 14:40:26 -0400 Subject: [PATCH] for now, use a separate xterm window for sterr output --- plugin/xlib/vimdot.sh | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/plugin/xlib/vimdot.sh b/plugin/xlib/vimdot.sh index 2ab294106..749fe6a38 100755 --- a/plugin/xlib/vimdot.sh +++ b/plugin/xlib/vimdot.sh @@ -3,28 +3,17 @@ error() { echo "$0: $*" >&2; exit 1; } -for prog in gvim vim ""; do - if test -x /usr/bin/$prog; then break; fi - if which $prog >/dev/null 2>&1; then break; fi -done +editor="/usr/bin/vim" -if test -z "$prog"; then error "the editor not found"; fi +if ! test -x "$editor"; then error "the \"$editor\" editor not found or not executable"; fi default="noname.gv" if test -z "$1"; then - if test -s "$default"; then - error "$default already exists" - else - f="$default" - fi -else - f="$1" -fi - -if ! test -f "$f"; then - if ! test -w .; then error "directory `pwd` is not writable"; fi - cat >"$f" <<EOF + f="$default" + if ! test -f "$f"; then + if ! test -w .; then error "directory `pwd` is not writable"; fi + cat >"$f" <<EOF digraph G { graph [layout=dot rankdir=LR] @@ -39,10 +28,15 @@ digraph G { {vim dot} -> vimdot } EOF + fi +else + f="$1" fi + if ! test -w "$f"; then error "$f is not writable"; fi # dot -Txlib watches the file $f for changes using inotify() -dot -Txlib "$f" & +# run it in an xterm window to handle any stderr +xterm -e dot -Txlib "$f" 2>/dev/null & # open an editor on the file $f (could be any editor; gvim &'s itself) -exec $prog "$f" +exec $editor "$f" -- 2.40.0