# pane.Pane.exit_mode

- **Module:** pane.Pane
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/pane.rs#L1082
- **Page:** https://libtmux.org/reference/rs/pane-pane-exit_mode/

```
pane.Pane.exit_mode(self) -> Result<(), Error>
```

Leave copy mode, or any other mode the pane is in.

A pane that is in no mode is left alone rather than refused, so this can
be called to reach a known state without asking first.

This dispatches `copy-mode -q` rather than the cancel key, because the
key reaches a pane through the copy-mode key table and clock mode and
tree mode have none: sending it there is answered "not in a mode" while
the pane stays in one. `-q` is the only exit that covers every mode,
including the ones [`Self::clock_mode`] and `choose-tree` create.

# Errors

Returns an error when tmux refuses the command.
