1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00
wezterm/docs/config/lua/keyassignment/ScrollToPrompt.md
Wez Furlong 37a3f7db5f wezterm: add ScrollToPrompt key assignment
Adds some supporting methods for computing the `SemanticZone`s
in the display and a key assignment that allows scrolling the
viewport to jump to the next/prev Prompt zone.
2020-11-08 09:58:02 -08:00

35 lines
1.1 KiB
Markdown

# ScrollToPrompt
*Since: nightly builds only*
This action operates on Semantic Zones defined by applications that use [OSC
133 Semantic Prompt Escapes](https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md) and requires configuring your shell to emit those sequences.
OSC 133 escapes allow marking regions of output as `Output` (from the commands
that you run), `Input` (that you type) and `Prompt` ("chrome" from your shell).
This action allows scrolling to the start of a `Prompt` zone; it takes an
argument that specifies the number of zones to move and the direction to move
in; `-1` means to move to the previous zone while `1` means to move to the next
zone.
This can make it convenient to skip over large amounts of output.
This action is not bound by default.
For the purposes of scrolling, the "current zone" is considered to be the one
closest to the top of the viewport.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="UpArrow", mods="SHIFT", action=wezterm.action{ScrollToPrompt=-1}},
{key="DownArrow", mods="SHIFT", action=wezterm.action{ScrollToPrompt=1}},
}
}
```