chiark / gitweb /
bash_profile: Find a useful editor automatically.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 16 Mar 2006 11:08:56 +0000 (11:08 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 16 Mar 2006 11:11:48 +0000 (11:11 +0000)
bash_profile

index 64a85f1e384898273a33a37dbb51ce17991b88f1..50d554272ec933740f075ecbd30bebdc56f4c60c 100644 (file)
@@ -101,7 +101,16 @@ umask 002
 
 unset LANG
 
-export EDITOR="emacs -nw"; export VISUAL="$EDITOR"
+export EDITOR=ed
+for ed in "emacs21 -nw" "emacs -nw" vi pico nano ae; do
+  name=`echo $ed | sed 's/ .*$//'`
+  if type -t >/dev/null "$name"; then
+    EDITOR=$ed
+    break
+  fi
+done
+export VISUAL="$EDITOR"
+
 export TEXINPUTS=".:$HOME/lib/tex//:"
 
 __mdw_addto INFOPATH r $HOME/info /usr/info /usr/share/info /usr/local/info