# tmux.Plan

- **Module:** tmux
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/plan.go#L126
- **Page:** https://libtmux.org/reference/go/tmux-plan/

Plan records ordered tmux commands for later execution. It groups commands that need no answer and lets later steps reference objects earlier steps create.

Recording touches nothing. [Plan.Preview] renders what would be sent and
[Plan.Explain] says how it would be grouped, both without a server;
[Plan.Run] is the only method that reaches tmux.

A Plan is not safe for concurrent use.

## Members

- `Len` (method) — Len returns how many operations the plan has recorded.
- `Ops` (method) — Ops returns the recorded operations, in order, for a [Planner] to group.
- `Explain` (method) — Explain reports how [Plan.Run] would group the recorded operations into tmux commands, and why each group ends where it does. It runs no commands.
- `ExplainWith` (method) — ExplainWith reports how planner would group the recorded operations.
- `Preview` (method) — Preview renders every recorded operation's argument vector without running anything, for the tmux version given.
- `Run` (method) — Run sends the recorded operations through server and returns one result per step.
- `RunWith` (method) — RunWith runs the plan with planner deciding dispatch grouping. Successful execution produces planner-independent results, but every operation in a failed grouped dispatch is [OpIndeterminate]. Use [Sequential] for exact attribution.
- `Cmd` (method) — Cmd records raw tmux arguments targeted at target.
- `CmdCapture` (method) — CmdCapture records raw tmux arguments whose output is returned in the step's [OpResult], and is otherwise [Plan.Cmd].
- `SplitPane` (method) — SplitPane records a split of the window or pane target names, and returns a [Ref] to the pane it will create.
- `SendKeys` (method) — SendKeys records keys sent to the pane target names.
- `DisplayMessage` (method) — DisplayMessage records a format expanded against the object target names, and returns its output in the step's [OpResult]. The zero [Ref] expands it against no object, the way [Plan.Cmd] takes one.
- `KillPane` (method) — KillPane records the destruction of the pane target names.
- `KillOtherPanes` (method) — KillOtherPanes records the destruction of every pane in the window holding the pane target names, except that pane.
- `SelectPane` (method) — SelectPane records a selection or marking of the pane target names.
- `ResizePane` (method) — ResizePane records a resize of the pane target names.
- `SetPaneTitle` (method) — SetPaneTitle records a title for the pane target names.
- `ClearHistory` (method) — ClearHistory records the clearing of the scrollback of the pane target names.
- `SendPrefix` (method) — SendPrefix records tmux's prefix key sent to the pane target names.
- `PipePane` (method) — PipePane records the pane target names having its output piped to a shell command.
- `RespawnPane` (method) — RespawnPane records the pane target names being restarted with a new command.
- `SwapPane` (method) — SwapPane records the panes target and source name exchanging places.
- `JoinPane` (method) — JoinPane records the pane source names being moved beside the pane target names, splitting that pane's space.
- `MovePane` (method) — MovePane records the pane source names being moved beside the pane target names without joining it to that pane's layout.
- `StartServer` (method) — StartServer records the tmux server being started if it is not running.
- `SetOption` (method) — SetOption records a tmux option written on the object target names, or on the server when target is the zero [Ref] and Global is set.
- `SetHook` (method) — SetHook records a tmux hook written on the object target names.
- `SetBuffer` (method) — SetBuffer records text stored in a tmux buffer.
- `DeleteBuffer` (method) — DeleteBuffer records a tmux buffer being removed. An empty name removes the most recently added buffer.
- `DetachClient` (method) — DetachClient records one client being detached. A client is named directly because plans do not create clients.
- `SuspendClient` (method) — SuspendClient records one client being suspended.
- `RefreshClient` (method) — RefreshClient records one client being asked to redraw.
- `SwitchClient` (method) — SwitchClient records one client being moved to the session target names. target may refer to a session an earlier step creates.
- `LockServer` (method) — LockServer records every client attached to the server being locked.
- `NewSession` (method) — NewSession records a detached session and returns a [Ref] to it.
- `KillSession` (method) — KillSession records the destruction of the session target names.
- `RenameSession` (method) — RenameSession records a new name for the session target names.
- `NextWindow` (method) — NextWindow records the session target names moving to its next window.
- `PreviousWindow` (method) — PreviousWindow records the session target names moving to its previous window.
- `LastWindow` (method) — LastWindow records the session target names returning to its previously current window.
- `LockSession` (method) — LockSession records every client attached to the session target names being locked.
- `DetachClients` (method) — DetachClients records every client attached to the session target names being detached.
- `SetEnvironment` (method) — SetEnvironment records a variable set in the session target names, or in the server when target is the zero [Ref].
- `UnsetEnvironment` (method) — UnsetEnvironment records a variable removed from the session target names, or from the server when target is the zero [Ref].
- `SourceFile` (method) — SourceFile records a tmux configuration file being loaded.
- `KillServer` (method) — KillServer records the tmux server being shut down. Nothing recorded after it can run because the server will be gone.
- `NewWindow` (method) — NewWindow records a window created in the session or beside the window that target names, and returns a [Ref] to it.
- `KillWindow` (method) — KillWindow records the destruction of the window target names.
- `KillOtherWindows` (method) — KillOtherWindows records the destruction of every window in the session holding the window target names, except that window.
- `RenameWindow` (method) — RenameWindow records a new name for the window target names.
- `SelectWindow` (method) — SelectWindow records the window target names becoming its session's current window.
- `SelectLayout` (method) — SelectLayout records a layout applied to the window target names.
- `NextLayout` (method) — NextLayout records the next preset layout applied to the window target names.
- `PreviousLayout` (method) — PreviousLayout records the previous preset layout applied to the window target names.
- `ResizeWindow` (method) — ResizeWindow records a resize of the window target names.
- `RotateWindow` (method) — RotateWindow records the panes of the window target names being rotated through their positions.
- `RespawnWindow` (method) — RespawnWindow records the window target names being restarted with a new command.
- `LastPane` (method) — LastPane records the window target names returning to its previously active pane.
- `LinkWindow` (method) — LinkWindow records the window source names being linked into the session target names.
- `UnlinkWindow` (method) — UnlinkWindow records the window target names being removed from the session it is linked into.
- `MoveWindow` (method) — MoveWindow records the window source names being moved into the session target names.
- `SwapWindow` (method) — SwapWindow records the windows target and source name exchanging places. Detach leaves each session's current window unchanged.
