From a6d7fd479404596d5d7fc8eba0fa8e4377e097ae Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 26 Feb 2026 12:43:50 -0600 Subject: [PATCH] store: cc() tmux alias: auto-launch Claude with nesting support --- ...unch-claude-with-nesting-support-ae6741.md | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 graph/configurations/cc-tmux-alias-auto-launch-claude-with-nesting-support-ae6741.md diff --git a/graph/configurations/cc-tmux-alias-auto-launch-claude-with-nesting-support-ae6741.md b/graph/configurations/cc-tmux-alias-auto-launch-claude-with-nesting-support-ae6741.md new file mode 100644 index 00000000000..09c01863e90 --- /dev/null +++ b/graph/configurations/cc-tmux-alias-auto-launch-claude-with-nesting-support-ae6741.md @@ -0,0 +1,43 @@ +--- +id: ae674150-d714-452a-bc65-7f866b45c8a9 +type: configuration +title: "cc() tmux alias: auto-launch Claude with nesting support" +tags: [tmux, zshrc, alias, claude-code, homelab, configuration] +importance: 0.55 +confidence: 0.8 +created: "2026-02-26T18:43:50.686761+00:00" +updated: "2026-02-26T18:43:50.686761+00:00" +--- + +# cc() tmux alias: auto-launch Claude with nesting support + +## Context + +Cal's `~/.zshrc` has a `cc()` function for quickly launching Claude Code inside a named tmux session. + +## Final Implementation + +```zsh +cc() { + local name="${1:-$(basename $PWD)}" + if [ -n "$TMUX" ]; then + tmux new -ds "$name" "claude" 2>/dev/null || tmux switch-client -t "$name" + tmux switch-client -t "$name" + else + tmux new -s "$name" -A "claude" + fi +} +``` + +## Key Behaviors + +- Auto-names session from current directory basename if no argument given +- Launches `claude` automatically inside the new session +- If already inside tmux (`$TMUX` is set): creates a detached session and switches to it, avoiding nested tmux +- If not in tmux: creates or attaches (`-A`) to the named session +- The `2>/dev/null || switch-client` pattern handles the case where the session already exists + +## Notes + +- Cal's terminal (Warp or similar) may auto-start tmux on login, so the nesting check is important in practice +- `cc project-name` overrides the auto-naming behavior