From c977fbf008e8438c3de9df57d93789671b7fb0a5 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 14 Aug 2012 09:18:36 +0000 Subject: Try to use a better editor than /usr/bin/vim - as if there was such a thing git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@544 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- rvi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rvi b/rvi index ac279fb..c1b57d9 100755 --- a/rvi +++ b/rvi @@ -37,6 +37,17 @@ if ! [ -e "$1" ] ; then exit 1 fi +if command -v sensible-editor >/dev/null 2>&1; then + editor=sensible-editor +elif command -v editor >/dev/null 2>&1; then + editor=editor +elif command -v vi >/dev/null 2>&1; then + editor=vi +else + echo "Cannot find an editor!" >&2 + exit 1 +fi + DN=`dirname "$1"` BN=`basename "$1"` if ! [ -e "$1,v" ] && ! [ -e "$DN/RCS/$BN,v" ] ; then @@ -66,7 +77,7 @@ fi if [ "$(id -u)" = "0" ]; then chown "$owner" "$1" fi -/usr/bin/vim "$1" +$editor "$1" ci -u "$1" if [ "$(id -u)" = "0" ]; then chown "$owner" "$1" -- cgit v1.2.3