# LibTmux::Window#split

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Ruby
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ruby/blob/da7b6191b9439e3c84fa1c9eeaa9168263ee7af4/gems/libtmux/lib/libtmux/entity.rb#L126
- **Page:** https://libtmux.org/en/ruby/v0.1.1/reference/libtmux-window-split/

```
def split: (
  direction: :horizontal | :vertical,
  command: ::Array[::String],
  ?size: ::Integer | ::String | nil,
  ?cwd: ::String?,
  ?environment: ::Hash[::String, ::String],
  ?focus: bool,
  ?timeout: ::Numeric,
  ?cancel: untyped
) -> ::LibTmux::Pane
```

Behavior: Creation.

Behavior contract: Creation.

## Parameters

- `direction` (`:horizontal | :vertical`)
- `command` (`::Array[::String]`)
- `size` (`::Integer | ::String | nil`)
- `cwd` (`::String?`)
- `environment` (`::Hash[::String, ::String]`)
- `focus` (`bool`)
- `timeout` (`::Numeric`)
- `cancel` (`untyped`)

## tmux command

The tmux commands behind `split`.

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

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_split_window_entry`](/en/tmux/latest/reference/c-variable-cmd_split_window_entry/) (attribute)
- [`cmd_split_window_exec`](/en/tmux/latest/reference/c-function-cmd-split-window-c-cmd_split_window_exec/) (function)

Each path starts at a function a command runs, which is degree 1. The degree counts steps from there along the path, and each step is a call or a reference: degree 2 is reached from that function, degree 3 from the next, and so on.

### Split a window

1. [`cmd_split_window_exec`](/en/tmux/latest/reference/c-function-cmd-split-window-c-cmd_split_window_exec/) (function)
2. references → [`spawn_pane`](/en/tmux/latest/reference/c-function-spawn_pane/) (function)
3. calls → [`window_add_pane`](/en/tmux/latest/reference/c-function-window_add_pane/) (function)
4. calls → [`window_pane_create`](/en/tmux/latest/reference/c-function-window-c-window_pane_create/) (function)

## In other ports

Split a window's active pane

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.split`](/en/py/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.split`](/en/java/latest/reference/io-github-libtmux-window-window-split/) (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) |
| 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:environment:shell:)`](/en/swift/latest/reference/server-splitwindow(_-direction-size-startdirectory-)/) (method) |

No equivalent is recorded in Lua, PowerShell, Julia, Elixir or F#.
