I like to work using a separate tmux session for each active project/folder that I'm juggling. This script will either create or attach to a project based on it's name, using fasd to jump to the directory directly. The project will be named based on the basename of the folder, for easy switching using TMUX-s.
Last active
August 29, 2015 13:56
-
-
Save evantravers/9191527 to your computer and use it in GitHub Desktop.
This creates a simple workspace in tmux
This file contains 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 | |
# this is for setting up a workspace in tmux | |
TARGET_DIR=$(fasd -d $@) | |
TARGET_NAME=$(basename "$TARGET_DIR") | |
TMUX= | |
tmux new -d -s "$TARGET_NAME" -c "$TARGET_DIR" | |
tmux switchc -t "$TARGET_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Periods are illegal in session names. My project folders are usually domain names and cause this script to fail.
Changing line 6 to the following avoids the issue:
TARGET_NAME=$(basename "$TARGET_DIR" | tr "." "-")