# LibTmux\Split-TmuxPane

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.PowerShell/SplitTmuxPaneCommand.cs#L9
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-split-tmuxpane/

```
Cells (default):
Split-TmuxPane
    [-Pane] <LibTmux.Pane>
    [-Horizontal]
    [-Before]
    [-Size <System.Nullable[System.Int32]>]
    [-StartDirectory <System.String>]
    [-Command <System.String>]
    [-Environment <System.Collections.IDictionary>]
    [-Activate]
    [-FullWindow]
    [-Zoom]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Percentage:
Split-TmuxPane
    [-Pane] <LibTmux.Pane>
    [-Horizontal]
    [-Before]
    -Percentage <System.Nullable[System.Int32]>
    [-StartDirectory <System.String>]
    [-Command <System.String>]
    [-Environment <System.Collections.IDictionary>]
    [-Activate]
    [-FullWindow]
    [-Zoom]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
```

Split an explicit pane and return the newly created pane.

Split a native [`Pane`](/en/csharp/latest/reference/libtmux-pane/) directly or through the pipeline. By default the new pane is
below its target and remains unselected. Horizontal chooses a left/right split;
Before places the new pane above or left of the target. Success returns the
captured native [`LibTmux.Pane`](/en/csharp/latest/reference/libtmux-pane/) for the new pane and does not refresh the original
handle in place.

### Notes

[`WhatIf`](/en/powershell/latest/reference/libtmux-split-tmuxpane/#LibTmux%5CSplit-TmuxPane.parameter.WhatIf) performs no core discovery or dispatch and emits no pane. Confirmation
precedes the core operation. The caller remains responsible for the created pane
and its process. Cancellation is not rollback and no mutation is retried.
Per-owner errors use [`Tmux.PaneSplitFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Split-TmuxPane.md#notes) and retain the core exception and
failed pane. [`ErrorAction`](/en/powershell/latest/reference/libtmux-split-tmuxpane/#LibTmux%5CSplit-TmuxPane.parameter.ErrorAction) Continue allows later owners to run. The core and tmux
enforce geometry and version capabilities.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Default parameter set:** Cells
- **Confirmation:** Supports `-WhatIf` and `-Confirm`; confirm impact: Medium.
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Pane`: Native pipeline type for this command.
- **Outputs:** `LibTmux.Pane`

Related APIs:

- [Task guide](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/create.md)

## Examples

Example 1

Place a new twenty-column pane to the left of the first pane on the server
identified by $SocketPath. The window must have enough room. The current pane
selection is preserved; the new /bin/sh process remains running until you remove
its pane.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Split-TmuxPane.md).

```powershell
LibTmux\New-TmuxServer -SocketPath $SocketPath |
    LibTmux\Get-TmuxPane | Select-Object -First 1 |
    LibTmux\Split-TmuxPane -Horizontal -Before -Size 20 -Command 'exec /bin/sh'
```

## Parameters

- `Pane` (`LibTmux.Pane`): Native pane to split. This is the only pipeline-bound parameter; binding by an
object's Pane property is not supported.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Horizontal` (`System.Management.Automation.SwitchParameter`): Split left to right instead of top to bottom. Without Before the new pane is on
the right.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Before` (`System.Management.Automation.SwitchParameter`): Place the new pane above the target, or on its left when Horizontal is present.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Size` (`System.Nullable[System.Int32]`): New pane size in cells, at least 1: columns for a horizontal split or rows
otherwise. Size and Percentage cannot be combined. Omit both to use tmux's
default split size. (for `Cells`)
  Optional. Named parameter. Does not accept pipeline input. [`ValidateRange(1, 2147483647)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validaterangeattribute?view=powershellsdk-7.4.0).
- `StartDirectory` (`System.String`): Working directory for the new pane. Use an absolute filesystem path for
predictable behavior. The core expands ~ and ~/; this cmdlet does not resolve
PowerShell provider paths or change the host's current directory.
  Optional. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `Command` (`System.String`): One shell-command string for the new pane. tmux interprets shell syntax in this
string; it is not an argument array. Omit it to use the configured default
command or shell.
  Optional. Named parameter. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `Environment` (`System.Collections.IDictionary`): A dictionary with string names and string values. Names must be nonempty and
contain neither '=' nor NUL (U+0000). Values may be empty but must not contain
NUL. Null or non-string entries are rejected before confirmation or dispatch.
Entries are copied for this invocation and do not change the PowerShell host
environment.
  Optional. Named parameter. Does not accept pipeline input. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Activate` (`System.Management.Automation.SwitchParameter`): Make the new pane active. By default the previously active pane remains active;
this switch does not attach a terminal.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `FullWindow` (`System.Management.Automation.SwitchParameter`): Split across the whole window instead of only the target pane.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Zoom` (`System.Management.Automation.SwitchParameter`): Ask tmux to zoom the new pane.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.
- `WhatIf` (`System.Management.Automation.SwitchParameter`): Runs the command in a mode that only reports what would happen without performing the actions.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `wi`.
- `Confirm` (`System.Management.Automation.SwitchParameter`): Prompts you for confirmation before running the cmdlet.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `cf`.
- `Percentage` (`System.Nullable[System.Int32]`): New pane size as a percentage from 1 through 100. Percentage and Size cannot be
combined. The requested geometry must still fit the window. (for `Percentage`)
  Required. Named parameter. Does not accept pipeline input. [`ValidateRange(1, 100)`](https://learn.microsoft.com/dotnet/api/system.management.automation.validaterangeattribute?view=powershellsdk-7.4.0).

## Returns

`LibTmux.Pane`: Captured native object for the created resource.
