summaryrefslogtreecommitdiff
path: root/rvi
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2012-08-14 09:18:36 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2012-08-14 09:18:36 +0000
commitc977fbf008e8438c3de9df57d93789671b7fb0a5 (patch)
tree6a75ee2256bb7b7fe37c740a52575a9ff4c1072b /rvi
parent7e64dc21f9050767942ec38500b33bf89f1f7c29 (diff)
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
Diffstat (limited to 'rvi')
-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"