summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrvi13
1 files changed, 12 insertions, 1 deletions
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"