Created
March 11, 2018 16:35
-
-
Save darthsuogles/d4bb6c46c840c225e478a7836a2d55b1 to your computer and use it in GitHub Desktop.
SSH tmux session with emacs
This file contains hidden or 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
| #!/bin/bash | |
| set -eux | |
| function help { | |
| echo "Please source this script instread of running it" | |
| } | |
| # https://www.emacswiki.org/emacs/EmacsdInitScript | |
| function init_emacs { | |
| export ALTERNATE_EDITOR="" | |
| emacs --daemon='dev' | |
| alias emacs='emacsclient -s dev' | |
| } | |
| function init_tmux { | |
| tmux new -d -s 'dev' | |
| } | |
| # Check if we already have a running emacs daemon | |
| daemon_pid="$(ps aux | grep -v grep | grep -Ei 'emacs --daemon' | awk '{print $2}')" | |
| [[ -n "${daemon_pid}" ]] || init_emacs | |
| tmux ls || init_tmux | |
| # Connect to the launched session | |
| tmux -2CC at -t 'dev' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment