Add session -p <project> flag

This flag sets the session name to `<project>` where `<project>` is a
git repository to make working with multiple worktrees more streamlined.
This commit is contained in:
2026-08-10 12:30:56 +01:00
parent d9d789f585
commit 06891857e5
2 changed files with 45 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ __session_sessions() {
list() {
for item in $HOME/.local/share/tmux/layouts/session-*; do
item=${item#$HOME/.local/share/tmux/layouts/}
# session-project is parameterized by -p, not a session of its own
[ "$item" = session-project ] && continue
echo ${item#session-}
done
}
@@ -12,6 +14,10 @@ __session_sessions() {
_describe 'session' sessions
}
__session_projects() {
_files -W $HOME/Projects -/
}
__session_hosts() {
list() {
declare -A hosts
@@ -28,5 +34,7 @@ __session_hosts() {
}
_arguments \
'(- *)'{-h,--help}'[Show usage information]' \
'(- *)'{-p,--project}'[Create or attach to a session for a project in ~/Projects]:project:__session_projects' \
':session:__session_sessions' \
':host:__session_hosts'