0
|
1 #!/bin/sh |
|
2 # "magically" pick the 'best' available editor for a given platform |
|
3 |
|
4 # use emacs if it is running a server |
|
5 # disabled because I ended up not liking using emacs as $EDITOR, weird, I know |
|
6 # tempuid=`id -u` |
|
7 # temphost=`hostname` |
|
8 # if [ -e "/tmp/esrv$tempuid-$temphost" ] |
|
9 # then |
|
10 # emacsclient "$@" |
|
11 # exit $? |
|
12 # fi |
|
13 |
|
14 # use subethaedit on OS X |
|
15 if test "`uname`" = "Darwin" ; then |
|
16 if test "x`whereis see`" != "x" ; then |
|
17 see -w "$@" |
|
18 exit $? |
|
19 # no subetha, then try for textwrangler |
|
20 elif test "x`whereis edit`" != "x" ; then |
|
21 edit -w "$@" |
|
22 exit $? |
|
23 fi |
|
24 fi |
|
25 |
|
26 # we're not on a mac (or preferred mac editors failed, so we like gvim |
|
27 if test "x`whereis gvim`" != "x" && test "x$DISPLAY" != "x" ; then |
|
28 gvim -f "$@" |
|
29 # ...or vim, since either gvim wasn't there or display wasn't set |
|
30 elif test "x`whereis vim`" != "x" ; then |
|
31 vim -f "$@" |
|
32 # wow, this is a weird host, use vi. if that doesn't exist, we're really screwed |
|
33 else |
|
34 vi "$@" |
|
35 fi |
|
36 |
|
37 exit $? |