-
-
Save anonymous/8f4c1c3314fa85133eb9c8b672a9bb87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vi { | |
running=$(ps aux | grep emacs | grep -v grep) | |
if [ -z "$running" ] | |
then | |
open -a "Emacs" | |
echo "not running" | |
/bin/sleep 8 | |
fi | |
if [[ ! -t 0 ]] | |
then | |
echo "pipe" | |
TMP="$(mktemp /tmp/stdin-XXX)" | |
cat >>$TMP | |
# emacsclient -a emacs $TMP | |
emacsclient -a emacs -nc $TMP | |
rm -f $TMP | |
elif [[ -z "$1" ]] | |
then | |
echo "no pipe no args" | |
emacsclient -nc "." | |
else | |
echo "no pipe with args" | |
emacsclient -nc "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment