#!/usr/bin/env zsh

# Canonical project-session entrypoint.
alias tp='tmproj'

# Explicit special-purpose vault flow.
function tvault { tmux new-session -A -s termius -c ~/obsidian-vault "${*:-pi; zsh}"; }

# Temporary compatibility shim while tmproj/tp becomes the canonical project entry.
function tm {
  print -u2 'tm is deprecated; use tvault for the Obsidian/Pi flow or tmproj (tp) for project sessions.'
  tvault "$@"
}

alias tl='tmux ls'

# Project bootstrap/switch helper (cmux-inspired workspace template)
function tmx { "${DOTFILES_BIN:-$HOME/.config/dotfiles/bin}/tmx" "$@"; }

if [[ -n $TMUX ]]; then # From inside tmux
  alias tf='tmux find-window'
  # Detach all other clients to this session
  alias mine='tmux detach -a'
  # Send command to other tmux window
  function tt {
    tmux send-keys -t .+ C-u && \
      tmux set-buffer "$*" && \
      tmux paste-buffer -t .+ && \
      tmux send-keys -t .+ Enter;
  }
  # Session management now handled by sesh (C-c t)
else # From outside tmux
  # Start grouped session so I can be in two different windows in one session
  function tdup { tmux new-session -t "${1:-$(tmux display-message -p '#S')}"; }
fi

# Omarchy-inspired dev layouts (tml, tmlm, nic, nicx, nicm, nicxm, tmlc, nicc, niccx)
source "${0:A:h}/omarchy.zsh"
