Last active
April 21, 2022 08:30
-
-
Save stephengfriend/ee166c27134ddba7ab1c0602db49a8a4 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