#!/usr/bin/env bash set -e projects_dir=$HOME/Projects # Find git repositories and worktrees if command -v fd &>/dev/null; then projects=$( fd -H '^\.git$' "$projects_dir" | sed -E -e "s|^$projects_dir/||" -e 's|/\.git/?$||' | sort -u ) else projects=$( find "$projects_dir" \( -name 'node_modules' -o -name '.git' \) -prune -name '.git' -print | sed -E -e "s|^$projects_dir/||" -e 's|/\.git/?$||' | sort -u ) fi project=$( echo "$projects" | fzf --layout=reverse --info=hidden --border=rounded --cycle ) tmux new-window -n "$project" -c "$projects_dir/$project" ~/.local/share/tmux/layouts/window-auto