Mercurial > dotfiles
annotate unixSoft/bin/magic_editor.sh @ 377:117e3c11d953
zprofile: introduce zprofile use
El Capitan (OS X 10.11) introduces a system-level /etc/zprofile which
uses a path_helper thing to mangle $PATH. Unfortunately, the way
path_helper works, it forces /usr/local/bin and /usr/bin to the
*start* of the PATH variable, which means that any PATH mutations I
want have to run after /etc/zprofile calls path_helper. As such, move
my path insertions into .zprofile{,-machine} rather than
.zshenv{,-machine} so that I can still ensure my path entries are at
the start of PATH rather than the end. This works because:
> Commands are then read from $ZDOTDIR/.zshenv. If the shell is a
> login shell, commands are read from /etc/zprofile and then
> $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands
> are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the
> shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
This means that non-login shells no longer pick up my custom PATH
entries, but as I only use OS X as a desktop OS that seems like a
workable tradeoff for now.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sun, 31 Jan 2016 20:46:29 -0500 |
parents | c30d68fbd368 |
children |
rev | line source |
---|---|
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 $? |