# Panes (/docs/v0.1/using/panes)



Each pane owns one process, terminal screen, and scrollback buffer. Splitting a
pane keeps the existing pane and places a new one beside it.

## Open a pane [#open-a-pane]

| Keys                           | Placement                   |
| ------------------------------ | --------------------------- |
| <kbd>\<C-p></kbd> <kbd>h</kbd> | Left                        |
| <kbd>\<C-p></kbd> <kbd>j</kbd> | Below                       |
| <kbd>\<C-p></kbd> <kbd>k</kbd> | Above                       |
| <kbd>\<C-p></kbd> <kbd>l</kbd> | Right                       |
| <kbd>\<C-p></kbd> <kbd>n</kbd> | `layout.new-pane-direction` |

From a shell:

```bash
koshi new-pane --direction right
koshi new-pane --stacked
koshi run --direction down -- cargo watch -x test
```

`new-pane` starts the default shell. `run` starts the command after `--`.
Both print the new pane id. Omit a target inside koshi to split the current
pane; outside koshi, pass `--pane`, `--tab`, or `--session` unless exactly one
session is running.

A shell pane inherits the working directory of the pane it splits. A command
pane runs the command and arguments you gave after `--`.

## Focus and resize [#focus-and-resize]

| Keys                              | Result                   |
| --------------------------------- | ------------------------ |
| <kbd>\<C-p></kbd> <kbd>←↓↑→</kbd> | Focus the nearby pane    |
| <kbd>\<C-s></kbd> <kbd>←↓↑→</kbd> | Move one border one cell |

Focus is per client: two terminals attached to one session may look at
different panes.

```bash
koshi focus-pane --pane <PANE_ID>
koshi resize-pane --pane <PANE_ID> --direction right --size 4
```

A positive resize grows toward the direction. A negative value shrinks from
that side.

## Stack and fullscreen [#stack-and-fullscreen]

`--stacked` adds a pane to the focused pane's stack. Stack members share one
rectangle; one is expanded and the others appear as one-row headers.

<kbd>Alt+f</kbd> fills the tab with the focused pane. Press it again to restore
the layout.

```bash
koshi toggle-pane-fullscreen
```

## Close a pane [#close-a-pane]

<kbd>\<C-p></kbd> <kbd>x</kbd> closes the focused pane and its process
tree.

```bash
koshi close-pane --pane <PANE_ID>
koshi close-pane --pane <PANE_ID> --force
```

Closing a pane promotes its sibling into the freed space. Closing the last pane
closes its tab; closing the last tab ends the session.

## Send input [#send-input]

```bash
koshi input --pane <PANE_ID> "cargo test"
koshi input --pane <PANE_ID> --no-enter "git status"
```

`input` types text into a pane and presses Enter by default. `--no-enter`
leaves it at the prompt.
