Skip to content

Instantly share code, notes, and snippets.

@howardabrams
Last active December 31, 2019 03:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save howardabrams/9239141 to your computer and use it in GitHub Desktop.
Save howardabrams/9239141 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