Improve e alias (opens emacs if not running)

This commit is contained in:
Henrik Lissner 2015-11-23 15:26:55 -05:00
parent 80f87fba54
commit da141671a0

View file

@ -60,7 +60,13 @@ fi
# Editors # Editors
is-callable 'nvim' && alias vim='nvim' is-callable 'nvim' && alias vim='nvim'
v() { vim ${@:-.}; } # Open in vim v() { vim ${@:-.}; } # Open in vim
e() { emacsclient -n ${@:-.}; } # Open in emacs (daemon) e() { # Open in emacs (daemon)
if pgrep Emacs; then
emacsclient -n ${@:-.};
else
/Applications/Emacs.app/Contents/MacOS/Emacs ${@:-.} &
fi
}
ee() { # emacs in project root ee() { # emacs in project root
git root 2>/dev/null && e "$(git rev-parse --show-toplevel)" || e . git root 2>/dev/null && e "$(git rev-parse --show-toplevel)" || e .
} }