# cmd_split_window_exec

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L53
- **Page:** https://libtmux.org/en/tmux/3.2a/reference/c-function-cmd-split-window-c-cmd_split_window_exec/

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

```c
static enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmdq_item *)
```

## Parameters

- `self` (`struct cmd *`)
- `item` (`struct cmdq_item *`)

## Paths through the source

Arrows name source relationships, not a runtime execution order.

### Split a window

[`cmd_split_window_exec`](/en/tmux/3.2a/reference/c-function-cmd-split-window-c-cmd_split_window_exec/) — references → [`spawn_pane`](/en/tmux/3.2a/reference/c-function-spawn_pane/) — calls → [`window_add_pane`](/en/tmux/3.2a/reference/c-function-window_add_pane/) — calls → [`window_pane_create`](/en/tmux/3.2a/reference/c-function-window-c-window_pane_create/)

## Calls

- [`args_first_value`](/en/tmux/3.2a/reference/c-function-args_first_value/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L143)
- [`args_get`](/en/tmux/3.2a/reference/c-function-args_get/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L150)
- [`args_has`](/en/tmux/3.2a/reference/c-function-args_has/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L72)
- [`args_next_value`](/en/tmux/3.2a/reference/c-function-args_next_value/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L146)
- [`args_strtonum`](/en/tmux/3.2a/reference/c-function-args_strtonum/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L92)
- [`cmd_find_from_winlink_pane`](/en/tmux/3.2a/reference/c-function-cmd_find_from_winlink_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L172)
- [`cmd_get_args`](/en/tmux/3.2a/reference/c-function-cmd_get_args/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L55)
- [`cmdq_error`](/en/tmux/3.2a/reference/c-function-cmdq_error/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L84)
- [`cmdq_get_current`](/en/tmux/3.2a/reference/c-function-cmdq_get_current/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L56)
- [`cmdq_get_target`](/en/tmux/3.2a/reference/c-function-cmdq_get_target/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L57)
- [`cmdq_get_target_client`](/en/tmux/3.2a/reference/c-function-cmdq_get_target_client/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L59)
- [`cmdq_insert_hook`](/en/tmux/3.2a/reference/c-function-cmdq_insert_hook/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L186)
- [`cmdq_print`](/en/tmux/3.2a/reference/c-function-cmdq_print/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L181)
- [`environ_create`](/en/tmux/3.2a/reference/c-function-environ_create/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L141)
- [`environ_free`](/en/tmux/3.2a/reference/c-function-environ_free/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L188)
- [`environ_put`](/en/tmux/3.2a/reference/c-function-environ_put/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L145)
- [`format_single`](/en/tmux/3.2a/reference/c-function-format_single/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L180)
- [`layout_close_pane`](/en/tmux/3.2a/reference/c-function-layout_close_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L165)
- [`layout_split_pane`](/en/tmux/3.2a/reference/c-function-layout_split_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L124)
- [`server_client_remove_pane`](/en/tmux/3.2a/reference/c-function-server_client_remove_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L164)
- [`server_redraw_window`](/en/tmux/3.2a/reference/c-function-server_redraw_window/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L174)
- [`server_status_session`](/en/tmux/3.2a/reference/c-function-server_status_session/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L175)
- [`strtonum`](/en/tmux/3.2a/reference/c-function-strtonum/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L81)
- [`window_pop_zoom`](/en/tmux/3.2a/reference/c-function-window_pop_zoom/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L173)
- [`window_push_zoom`](/en/tmux/3.2a/reference/c-function-window_push_zoom/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L113)
- [`window_remove_pane`](/en/tmux/3.2a/reference/c-function-window_remove_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L166)
- [`xstrdup`](/en/tmux/3.2a/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-split-window.c#L79)

## Other function references

- [`spawn_pane`](/en/tmux/3.2a/reference/c-function-spawn_pane/) (function)
- [`window_pane_start_input`](/en/tmux/3.2a/reference/c-function-window_pane_start_input/) (function)

## Referenced by

- [`cmd_split_window_entry`](/en/tmux/3.2a/reference/c-variable-cmd_split_window_entry/) (attribute)

## Referenced declarations

- [`args.argc`](/en/tmux/3.2a/reference/c-struct-args-argc/) (attribute)
- [`spawn_context.argc`](/en/tmux/3.2a/reference/c-struct-spawn_context-argc/) (attribute)
- [`args.argv`](/en/tmux/3.2a/reference/c-struct-args-argv/) (attribute)
- [`spawn_context.argv`](/en/tmux/3.2a/reference/c-struct-spawn_context-argv/) (attribute)
- [`cmd`](/en/tmux/3.2a/reference/c-struct-cmd/) (struct)
- [`CMD_RETURN_ERROR`](/en/tmux/3.2a/reference/c-enum-cmd_retval-cmd_return_error/) (constant)
- [`CMD_RETURN_NORMAL`](/en/tmux/3.2a/reference/c-enum-cmd_retval-cmd_return_normal/) (constant)
- [`CMD_RETURN_WAIT`](/en/tmux/3.2a/reference/c-enum-cmd_retval-cmd_return_wait/) (constant)
- [`cmd_retval`](/en/tmux/3.2a/reference/c-enum-cmd_retval/) (enum)
- [`cmdq_item`](/en/tmux/3.2a/reference/c-struct-cmdq_item/) (struct)
- [`cmd_find_state.current`](/en/tmux/3.2a/reference/c-struct-cmd_find_state-current/) (attribute)
- [`spawn_context.cwd`](/en/tmux/3.2a/reference/c-struct-spawn_context-cwd/) (attribute)
- [`spawn_context.environ`](/en/tmux/3.2a/reference/c-struct-spawn_context-environ/) (attribute)
- [`cmd_find_state.flags`](/en/tmux/3.2a/reference/c-struct-cmd_find_state-flags/) (attribute)
- [`spawn_context.flags`](/en/tmux/3.2a/reference/c-struct-spawn_context-flags/) (attribute)
- [`spawn_context.idx`](/en/tmux/3.2a/reference/c-struct-spawn_context-idx/) (attribute)
- [`spawn_context.item`](/en/tmux/3.2a/reference/c-struct-spawn_context-item/) (attribute)
- [`LAYOUT_LEFTRIGHT`](/en/tmux/3.2a/reference/c-enum-layout_type-layout_leftright/) (constant)
- [`LAYOUT_TOPBOTTOM`](/en/tmux/3.2a/reference/c-enum-layout_type-layout_topbottom/) (constant)
- [`spawn_context.lc`](/en/tmux/3.2a/reference/c-struct-spawn_context-lc/) (attribute)
- [`spawn_context.name`](/en/tmux/3.2a/reference/c-struct-spawn_context-name/) (attribute)
- [`cmd_find_state.s`](/en/tmux/3.2a/reference/c-struct-cmd_find_state-s/) (attribute)
- [`spawn_context.s`](/en/tmux/3.2a/reference/c-struct-spawn_context-s/) (attribute)
- [`SPAWN_BEFORE`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_before/) (constant)
- [`SPAWN_DETACHED`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_detached/) (constant)
- [`SPAWN_EMPTY`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_empty/) (constant)
- [`SPAWN_FULLSIZE`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_fullsize/) (constant)
- [`SPAWN_ZOOM`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_zoom/) (constant)
- [`SPLIT_WINDOW_TEMPLATE`](/en/tmux/3.2a/reference/c-define-cmd-split-window-c-split_window_template/) (constant)
- [`window_pane.sx`](/en/tmux/3.2a/reference/c-struct-window_pane-sx/) (attribute)
- [`window_pane.sy`](/en/tmux/3.2a/reference/c-struct-window_pane-sy/) (attribute)
- [`window_pane.window`](/en/tmux/3.2a/reference/c-struct-window_pane-window/) (attribute)
- [`cmd_find_state.wl`](/en/tmux/3.2a/reference/c-struct-cmd_find_state-wl/) (attribute)
- [`spawn_context.wl`](/en/tmux/3.2a/reference/c-struct-spawn_context-wl/) (attribute)
- [`cmd_find_state.wp`](/en/tmux/3.2a/reference/c-struct-cmd_find_state-wp/) (attribute)
- [`spawn_context.wp0`](/en/tmux/3.2a/reference/c-struct-spawn_context-wp0/) (attribute)
