Skip to content

Instantly share code, notes, and snippets.

@analyticd
Forked from howardabrams/.profile.sh
Created December 31, 2019 03:31
Show Gist options
  • Save analyticd/78d1bb2f9659b04c3c46295948dc5d43 to your computer and use it in GitHub Desktop.
Save analyticd/78d1bb2f9659b04c3c46295948dc5d43 to your computer and use it in GitHub Desktop.
Bulk of my server-side profile that when I first log into the system, it starts up Emacs as a daemon and a `tmux` session. From then on, I just attach to that `tmux,` and use `emacsclient` to edit files... especially with a `split-window`.
alias e='emacsclient -q -a emacs'
EDITOR=emacsclient
function e {
tmux new-window -a -n "emacs" "$EDITOR $@"
}
function ee {
tmux split-window "$EDITOR $@"
}
# If we have a tmux session running, attach to it, otherwise, start
# one up....oh, and let's start emacs as a daemon too.
if type tmux >/dev/null 2>&1
then
if ps -u $USER -o fname | grep tmux >/dev/null
then
if [ -z "$TMUX" ]
then
unalias e
tmux attach
fi
else
emacs --daemon
exec tmux
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment