Last active
July 2, 2023 04:33
-
-
Save binarymatt/b0a8f278d6969618f2b6e5ab309a15ef to your computer and use it in GitHub Desktop.
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 | |
function tmux_create { | |
SESSION_NAME=$1 | |
tmux new -s $SESSION_NAME -n neovim | |
} | |
#new session base name is current directory name | |
DIR_NAME=${PWD##*/} | |
DIR_NAME=${DIR_NAME//./_} | |
echo "checking for tmux session with name '$DIR_NAME'." | |
tmux has -t $DIR_NAME 2> /dev/null | |
retVal=$? | |
if [ $retVal -ne 0 ] | |
then | |
echo "Session not found. Create Session '$DIR_NAME'." | |
tmux_create $DIR_NAME | |
else | |
echo "attaching to session '$DIR_NAME'" | |
tmux a -t $DIR_NAME | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment