]> granicus.if.org Git - graphviz/commitdiff
use if set
authorJohn Ellson <ellson@research.att.com>
Fri, 16 Jan 2015 14:33:49 +0000 (09:33 -0500)
committerJohn Ellson <ellson@research.att.com>
Fri, 16 Jan 2015 14:33:49 +0000 (09:33 -0500)
plugin/xlib/vimdot.sh

index 4e6dd4bb406d82184352739ad0e6f3114cddab7f..cd40fccbc25d3923e7d8eaa77c14ffc61469993e 100755 (executable)
@@ -3,9 +3,11 @@
 
 error() { echo "$0: $*" >&2; exit 1; }
 
-editor="vim"
-
-if ! test -x "$(command -v "$editor")"; then error "the \"$editor\" editor not found or not executable"; fi
+# Try $EDITOR first, else try vim or vi
+editor="$EDITOR"
+[ -x "$editor" ] || editor="/usr/bin/vim"
+[ -x "$editor" ] || editor="/usr/bin/vi"
+[ -x "$editor" ] || error "EDITOR not found or not executable";
 
 default="noname.gv"