# libtmux.Window.split

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/window.py#L507
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-window-split/

tmux command: [`split-window`](/en/tmux/latest/manual/split-window/)

```
libtmux.Window.split(
    self,
    target: int | str | None = None,
    start_directory: StrPath | None = None,
    attach: bool = False,
    direction: PaneDirection | None = None,
    full_window_split: bool | None = None,
    zoom: bool | None = None,
    shell: str | None = None,
    size: str | int | None = None,
    percentage: int | None = None,
    environment: dict[str, str] | None = None,
    empty: bool | None = None,
    style: str | None = None,
    active_border_style: str | None = None,
    inactive_border_style: str | None = None,
    message: str | None = None,
    keep: bool | None = None,
) -> Pane
```

Split window on active pane and return the created :class:`Pane`.

## Parameters

- `target` (`int | str | None`)
- `start_directory` (`StrPath | None`): Specifies the working directory in which the new window is created.
- `attach` (`bool`): Make new window the current window after creating it, default
True.
- `direction` (`PaneDirection | None`): Split in direction. If none is specified, assume down.
- `full_window_split` (`bool | None`): Split across full window width or height, rather than active pane.
- `zoom` (`bool | None`): Expand pane.
- `shell` (`str | None`): Execute a command on splitting the window. The pane will close
when the command exits.
NOTE: When this command exits the pane will close. This feature
is useful for long-running processes where the closing of the
window upon completion is desired.
- `size` (`str | int | None`): Cell/row count to occupy with respect to current window.
- `percentage` (`int | None`): Percentage (0-100) of the window to occupy (``-p`` flag).
Mutually exclusive with *size*. (added 0.56)
- `environment` (`dict[str, str] | None`): Environmental variables for new pane. Passthrough to ``-e``.
- `empty` (`bool | None`): Create an empty pane with no command (``-E`` flag) instead of
spawning the default shell. Requires tmux 3.7+. If used with
tmux < 3.7, a warning is issued and the flag is ignored.
- `style` (`str | None`): Style for the new pane (``-s``). Requires tmux 3.7+.
- `active_border_style` (`str | None`): Active-pane border style (``-S``). Requires tmux 3.7+.
- `inactive_border_style` (`str | None`): Inactive-pane border style (``-R``). Requires tmux 3.7+.
- `message` (`str | None`): Keep the pane open (until a key is pressed) after exit, showing this
``remain-on-exit-format`` message (``-m``). Requires tmux 3.7+.
- `keep` (`bool | None`): Keep the pane open until a key is pressed after exit (``-k``).
Requires tmux 3.7+. These 3.7 flags warn and are ignored below 3.7.

## Returns

:class:`Pane`
    The newly created pane.

## In other ports

### Split a window's active pane

- Ruby: [`LibTmux::Window#split`](/en/ruby/latest/reference/libtmux-window-split/) (method)
- TypeScript: [`window.Window.split`](/en/ts/latest/reference/window-window-split/) (method)
- Rust: [`window.Window.split`](/en/rs/latest/reference/window-window-split/) (method)
- Go: [`tmux.Window.SplitPane`](/en/go/latest/reference/tmux-window-splitpane/) (method)
- Java: [`io.github.libtmux.Window.Window.split`](/en/java/latest/reference/io-github-libtmux-window-window-split/) (method)
- C#: [`LibTmux.Window.SplitPaneAsync`](/en/csharp/latest/reference/libtmux-window-splitpaneasync/) (method)
- C++: [`libtmux::Window::split`](/en/cxx/latest/reference/libtmux-window-split/) (method)
- Swift: [`Server.splitWindow(_:direction:size:startDirectory:)`](/en/swift/latest/reference/server-splitwindow(_-direction-size-startdirectory-)/) (method)
- Kotlin: [`io.github.libtmux.kotlin.Window.split`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-window-split/) (method)
- Scala: [`io.github.libtmux.scaladsl.Window.split`](/en/scala/latest/reference/io-github-libtmux-scaladsl-window-split/) (method)
