diff --git a/project.sh b/project.sh new file mode 100755 index 0000000..c9582f2 --- /dev/null +++ b/project.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +projects=() + +# Get list of projects from ~/Projects +for dir in $HOME/Projects/**/*; do + if [ -d $dir ]; then + projects+=(${dir#$HOME/Projects/}) + fi +done + +project=$( + echo "${projects[@]}" | tr ' ' '\n' | sort -u | + fzf --layout=reverse --info=hidden --border=rounded --cycle +) + +tmux new-window -n $project -c ~/Projects/$project +~/.local/share/tmux/layouts/window-auto diff --git a/tmux.conf b/tmux.conf index d1fc2d4..66b15cb 100644 --- a/tmux.conf +++ b/tmux.conf @@ -66,6 +66,8 @@ if -b '[ "`uname`" = "Darwin" ]' \ bind T display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -E $SHELL # Open a popup with session creator/switcher bind S display-popup -B -w 60 -h 10 -E '~/.config/tmux/session.sh' +# Open a popup with project selector +bind P display-popup -B -w 60 -h 10 -E '~/.config/tmux/project.sh' # Open a popup to pick an interpreter then launch it bind I display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -E '$SHELL -i ~/.config/tmux/interpreter.sh'