-
-
Save AlexRogalskiy/7efd302d2f6f330b6cbf62481997469f to your computer and use it in GitHub Desktop.
Visual Studio Code + tmux session integration
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
# Auto Start Tmux (must be last) | |
if [[ -z "$TMUX" ]] then | |
tmux_session='default' | |
terminal_slug="`echo $TERM_PROGRAM | iconv -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9-]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z | head -c 7`" | |
if [[ $TERM_PROGRAM == 'vscode' ]]; then | |
tmux_session="$terminal_slug-`pwd | sha1sum | head -c 8`" | |
fi | |
tmux new-session -A -d -s "$tmux_session" | |
# Disable the destruction of the new, unattached session. | |
tmux set-option -t "$tmux_session" destroy-unattached off &> /dev/null | |
exec tmux attach-session -t "$tmux_session" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment