zmxx is a workspace tool that combines git worktree
with zmx.
- Navigate to the Git repository you want to work on in your terminal.
- Run
zmxx new <branch>to create a worktree and launch Neovim in a zmx session. - Press
Zlin Neovim to open the zmx session picker and switch to another workspace.
- Go 1.24 or later (for building)
- zmx 0.8.1 or later (required for labels, session switching, and
--vtscrollback) - Neovim 0.10 or later (uses
vim.system) - fzf-lua (picker UI)
go install github.com/devoc09/zmxx/cmd/zmxx@latest
# Or build locally
go build -o ~/.local/bin/zmxx ./cmd/zmxx{
"devoc09/zmxx",
dependencies = { "ibhagwan/fzf-lua" },
event = "VeryLazy",
}# Create a workspace and launch Neovim (reuse an existing branch, or create one from HEAD)
zmxx new feature/foo
# Create a branch from a different starting point
zmxx new feature/bar --base main
# List all zmxx sessions
zmxx ls
# Kill a session and remove its worktree (keep the branch)
zmxx rm zmxx-0123456789ab-0123456789ab
# Remove a workspace with work in progress (-f skips confirmation and discards uncommitted changes)
zmxx rm <session> -fA workspace's zmx session is shell-based. zmxx new launches nvim . inside the session, but closing Neovim with :q keeps the session alive and returns you to a shell prompt in the workspace.
# Restart Neovim from the shell inside the session
nvim .You can return to this workspace at any time using zmxx switch from another terminal or using the picker. Only zmxx rm explicitly terminates the session.
In Neovim:
| Action | Description |
|---|---|
Zl |
Open the picker for all zmxx sessions |
:ZmxxSessions |
Open the picker using a command |
In the picker:
- Filter by repository name, branch, worktree path, or connection count. Session names are hidden.
- Preview the selected session's scrollback with
zmxx preview, which renders it through zmx's virtual terminal (zmx history --vt) so ANSI colors match the original terminal, usingfollowto keep the preview scrolled to the bottom. - Press
Enterto switch the terminal's zmx client to the selected session. Neovim itself continues running in the original session. - When Neovim is running outside a zmx session, the picker opens a new terminal tab and attaches to the selected session. Detach with zmx's
Ctrl+\to close the tab and return to the original Neovim instance.
- Worktrees are placed at deterministic paths under
$XDG_DATA_HOME/zmxx/worktrees/<repo-id>/<branch-slug>-<hash>. IfXDG_DATA_HOMEis unset, the base directory defaults to~/.local/share/zmxx. <repo-id>is the first 12 hexadecimal characters of the SHA-256 hash of the origin URL, or the Git common directory if no origin URL is available.- zmx sessions are named
zmxx-<repo-id>-<branch-hash>, with 12 characters for each hash, to fit within Unix socket path length limits. - The session command is
bash -c 'nvim .; exec "${SHELL:-/bin/sh}"'. After Neovim exits, the shell takes over, keeping the workspace alive untilzmxx rm. - Sessions are tagged with
zmxx=1/zmxx.repo/zmxx.reponame/zmxx.branch/zmxx.worktreelabels (metadata values use base64url encoding). The picker uses these labels to discover all zmxx sessions. - Switching uses zmx's native Switch IPC: running
zmxx switch <name>→zmx attach <name>from Neovim lets zmx useZMX_SESSIONto move only the terminal's client to the target session. - If
ZMX_SESSIONis unset,zmxx switch <name>runs in a Neovim terminal tab, connecting as a client with a PTY for interactive use. zmxx switchonly accepts existing sessions, preventing accidental session creation through upsert behavior.
- Do not use
ZMX_SESSION_PREFIXfor sessions managed by zmxx. zmxx clears the prefix for every zmx call. zmxx rmkills the zmx session first. Removing the session you are currently attached to disconnects your terminal.- Sessions share a single namespace across repositories. The picker displays all zmxx sessions.
- To run a command other than Neovim in a workspace, use
zmx attach <session-name> <command>directly. Runzmxx lsto find the session name.