gwm-cli 1.1.1

git worktree manager — TUI + CLI, native libgit2, per-repo bootstrap
Documentation
---
title: tmux / zellij integration
description: "`gwm tmux` / `gwm zellij` to open a worktree in a new window, pane, or tab."
---

# tmux / zellij integration

Inside an already-running multiplexer session, `gwm tmux` and `gwm zellij` spawn a new window / pane / tab whose shell starts inside the matched worktree — no manual `cd` round-trip needed.

## tmux

```bash
gwm tmux auth                  # new tmux window inside the matched worktree
gwm tmux auth -p               # split the current pane instead
gwm tmux auth --split          # ...long form of -p
```

Under the hood:

- **new window** (default): `tmux new-window -n <name> -c <path>`
- **split** (`-p` / `--split`): `tmux split-window -c <path>` (current window's layout, current pane's direction)

The `-n <name>` arg names the new window after the worktree slug so it stands out in the status bar.

## zellij

```bash
gwm zellij auth                # new zellij tab inside the matched worktree
gwm zellij auth -p             # new pane in the current tab instead
```

Under the hood:

- **new tab** (default): `zellij action new-tab --name <name> --cwd <path>`
- **new pane** (`-p` / `--split`): `zellij action new-pane --cwd <path>`

The `--cwd` flag on `new-tab` requires **zellij ≥ 0.40**; older versions error out. `new-pane --cwd` has been stable longer — use `-p` if you're stuck on an older zellij.

## required session

Both commands require the corresponding multiplexer to actually be running:

- `gwm tmux` checks for `$TMUX` in the environment.
- `gwm zellij` checks for `$ZELLIJ`.

Outside a session, the command **refuses** with a clear error rather than spawning a stray server — the alternative (spawning detached) leads to orphaned sessions that the user never sees.

```bash
$ gwm tmux auth
gwm tmux requires an active tmux session ($TMUX is not set).
```

## fuzzy matching

The `<pattern>` arg uses the same fuzzy matcher as `gwm path / remove / bootstrap` ([nucleo-matcher](https://docs.rs/nucleo-matcher)). Ambiguous matches exit `1` and print both candidates without spawning anything.

## see also

- [TUI → Fuzzy filter]/tui/filter — the matcher's case-sensitivity and scoring rules
- [CLI → Subcommand reference]/cli/reference#gwm-tmux-pattern--p--split — flags and exit codes