2020-05-30 21:35:53 +03:00
|
|
|
## Scrollback
|
|
|
|
|
|
|
|
WezTerm provides a searchable scrollback buffer with a configurable maximum
|
|
|
|
size limit that allows you to review information that doesn't fit in the
|
|
|
|
physical window size. As content is printed to the display the display may be
|
|
|
|
scrolled up to accommodate newly added lines. The scrolled lines are moved
|
|
|
|
into the scrollback buffer and can be reviewed by scrolling the window up or
|
|
|
|
down.
|
|
|
|
|
|
|
|
This section describes working with the scrollback and discusses some
|
|
|
|
configuration options; be sure to read the [configuration
|
|
|
|
docs](config/files.html) to learn how to change your settings!
|
|
|
|
|
|
|
|
### Controlling the scrollback size
|
|
|
|
|
|
|
|
This value serves as an upper bound on the number of lines.
|
|
|
|
The larger this value, the more memory is required to manage the tab.
|
|
|
|
If you have a lot of long lived tabs then making this value very large
|
|
|
|
may put some pressure on your system depending on the amount of RAM
|
|
|
|
you have available.
|
|
|
|
|
|
|
|
```lua
|
|
|
|
return {
|
|
|
|
-- How many lines of scrollback you want to retain per tab
|
|
|
|
scrollback_lines = 3500,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Clearing the scrollback buffer
|
|
|
|
|
|
|
|
By default, `CTRL-SHIFT-K` and `CMD-K` will trigger the `ClearScrollback`
|
|
|
|
action and discard the contents of the scrollback buffer. There is no way
|
|
|
|
to undo discarding the scrollback.
|
|
|
|
|
2021-02-20 19:44:39 +03:00
|
|
|
See the [ClearScrollback](config/lua/keyassignment/ClearScrollback.md) docs for information
|
2020-05-30 21:35:53 +03:00
|
|
|
on rebinding this key.
|
|
|
|
|
|
|
|
### Enable/Disable scrollbar
|
|
|
|
|
|
|
|
You can control whether WezTerm displays a scrollbar via your configuration
|
|
|
|
file:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
return {
|
|
|
|
-- Enable the scrollbar.
|
|
|
|
-- It will occupy the right window padding space.
|
|
|
|
-- If right padding is set to 0 then it will be increased
|
|
|
|
-- to a single cell width
|
|
|
|
enable_scroll_bar = true,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
You may [change the color of the scrollbar](config/appearance.html#defining-your-own-colors) if you wish!
|
|
|
|
|
|
|
|
### Scrolling without a scrollbar
|
|
|
|
|
2020-11-24 21:13:41 +03:00
|
|
|
By default, `SHIFT-PageUp` and `SHIFT-PageDown` will adjust the viewport scrollback position
|
2020-05-30 21:35:53 +03:00
|
|
|
by one full screen for each press.
|
|
|
|
|
2022-05-01 18:03:32 +03:00
|
|
|
See the [ScrollByPage](config/lua/keyassignment/ScrollByPage.md) docs for more information
|
2020-05-30 21:35:53 +03:00
|
|
|
on this key binding assignment.
|
|
|
|
|
|
|
|
### Searching the scrollback
|
|
|
|
|
|
|
|
By default, `CTRL-SHIFT-F` and `CMD-F` (`F` for `Find`) will activate the
|
|
|
|
search overlay in the current tab.
|
|
|
|
|
|
|
|
When the search overlay is active the behavior of wezterm changes:
|
|
|
|
|
2021-02-08 05:23:04 +03:00
|
|
|
* Typing (or pasting) text will populate the *search pattern* in the bar at the bottom of the screen.
|
2020-05-30 21:35:53 +03:00
|
|
|
* Text from the scrollback that matches the *search pattern* will be highlighted and
|
2021-02-08 05:23:04 +03:00
|
|
|
the number of matches shown in the search bar.
|
2020-05-30 21:35:53 +03:00
|
|
|
* The bottom-most match will be selected and the viewport scrolled to show the selected
|
|
|
|
text.
|
2021-02-08 05:23:04 +03:00
|
|
|
* `Enter`, `UpArrow` and `CTRL-P` will cause the selection to move to any prior matching text.
|
2020-06-05 18:54:16 +03:00
|
|
|
* `PageUp` will traverse to previous matches one page at a time.
|
2021-02-08 05:23:04 +03:00
|
|
|
* `CTRL-N` and `DownArrow` will cause the selection to move to any next matching text.
|
2020-06-05 18:54:16 +03:00
|
|
|
* `PageDown` will traverse to the next match one page at a time.
|
2020-05-30 21:35:53 +03:00
|
|
|
* `CTRL-R` will cycle through the pattern matching mode; the initial mode is case-sensitive
|
|
|
|
text matching, the next will match ignoring case and the last will match using the
|
|
|
|
[regular expression syntax described here](https://docs.rs/regex/1.3.9/regex/#syntax).
|
|
|
|
The matching mode is indicated in the search bar.
|
2021-02-08 05:23:16 +03:00
|
|
|
* `CTRL-U` will clear the *search pattern* so you can start over.
|
2021-02-08 05:23:04 +03:00
|
|
|
* `CTRL-SHIFT-C` will copy the selected text to the clipboard.
|
2020-05-30 21:35:53 +03:00
|
|
|
* `Escape` will cancel the search overlay, leaving the currently selected text selected
|
|
|
|
with the viewport scrolled to that location.
|
|
|
|
|
2022-05-07 05:47:42 +03:00
|
|
|
#### Configurable search mode key assignments
|
|
|
|
|
|
|
|
*Since: nightly builds only*
|
|
|
|
|
|
|
|
The key assignments for copy mode are specified by the `search_mode` [Key Table](config/key-tables.md).
|
|
|
|
|
|
|
|
You may provide your own definition of this key table if you wish to customize it.
|
|
|
|
There isn't a way to override portions of the key table, only to replace the entire table.
|
|
|
|
|
|
|
|
The default configuration is equivalent to:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
local wezterm = require 'wezterm'
|
|
|
|
|
|
|
|
return {
|
|
|
|
key_tables = {
|
|
|
|
search_mode = {
|
|
|
|
{key="Escape", mods="NONE", action=wezterm.action{CopyMode="Close"}},
|
|
|
|
{key="UpArrow", mods="NONE", action=wezterm.action{CopyMode="PriorMatch"}},
|
|
|
|
{key="Enter", mods="NONE", action=wezterm.action{CopyMode="PriorMatch"}},
|
|
|
|
{key="p", mods="CTRL", action=wezterm.action{CopyMode="PriorMatch"}},
|
|
|
|
{key="PageUp", mods="NONE", action=wezterm.action{CopyMode="PriorMatchPage"}},
|
|
|
|
{key="PageDown", mods="NONE", action=wezterm.action{CopyMode="NextMatchPage"}},
|
|
|
|
{key="n", mods="CTRL", action=wezterm.action{CopyMode="NextMatchPage"}},
|
|
|
|
{key="DownArrow", mods="NONE", action=wezterm.action{CopyMode="NextMatch"}},
|
|
|
|
{key="r", mods="CTRL", action=wezterm.action{CopyMode="CycleMatchType"}},
|
|
|
|
{key="u", mods="CTRL", action=wezterm.action{CopyMode="ClearPattern"}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
(Those assignments reference `CopyMode` because search mode is a facet of [Copy Mode](copymode.md)).
|
|
|
|
|
2020-05-30 21:35:53 +03:00
|
|
|
### Configuring Saved Searches
|
|
|
|
|
2020-06-17 10:08:43 +03:00
|
|
|
*since: 20200607-144723-74889cd4*
|
2020-06-05 18:19:23 +03:00
|
|
|
|
2020-05-30 21:35:53 +03:00
|
|
|
If you find that you're often searching for the same things then you may wish to assign
|
|
|
|
a keybinding to trigger that search.
|
|
|
|
|
|
|
|
For example, if you find that you're frequently running `git log` and then reaching
|
|
|
|
for your mouse to copy and paste a relevant git commit hash then you might like
|
|
|
|
this:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
local wezterm = require 'wezterm';
|
|
|
|
return {
|
|
|
|
keys = {
|
|
|
|
-- search for things that look like git hashes
|
|
|
|
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={Regex="[a-f0-9]{6,}"}}},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
With that in your config you can now:
|
|
|
|
|
|
|
|
* `CTRL-SHIFT-H` to highlight all the git hashes and select the closest one to the bottom
|
|
|
|
of the screen.
|
|
|
|
* Use `ENTER`/`CTRL-N`/`CTRL-P` to cycle through the git hashes
|
|
|
|
* `CTRL-SHIFT-C` to copy
|
|
|
|
* `Escape`
|
|
|
|
* `CTRL-SHIFT-V` (or `SHIFT-Insert`) to Paste
|
|
|
|
|
|
|
|
without needing to reach for your mouse.
|
|
|
|
|
2020-10-27 19:02:09 +03:00
|
|
|
See [the Search action docs](config/lua/keyassignment/Search.html) for more information on
|
2020-05-30 21:35:53 +03:00
|
|
|
using the `Search` action.
|