Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for creating tmux session from ghq projects
Also bind it in tmux to run it with a shortcut.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
# set -e | ||
set -x | ||
|
||
SELECTED_PROJECT_PATH=$(find ~/ghq -type d -maxdepth 3 -mindepth 3 | fzf) | ||
SESSION_NAME=$(echo $SELECTED_PROJECT_PATH | awk -F '/' '{print $NF}') | ||
|
||
echo $SELECTED_PROJECT_PATH | ||
echo $SESSION_NAME | ||
|
||
tmux has-session -t $SESSION_NAME | ||
|
||
if [ $? != 0 ]; then | ||
tmux new-session -d -s $SESSION_NAME -c $SELECTED_PROJECT_PATH | ||
fi | ||
|
||
tmux switch-client -t $SESSION_NAME |
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