2020-05-30 21:35:53 +03:00
|
|
|
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
|
2023-03-16 05:22:51 +03:00
|
|
|
docs](config/files.md) to learn how to change your settings!
|
2020-05-30 21:35:53 +03:00
|
|
|
|
|
|
|
### 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,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-03-16 05:22:51 +03:00
|
|
|
You may [change the color of the scrollbar](config/appearance.md#defining-your-own-colors) if you wish!
|
2020-05-30 21:35:53 +03:00
|
|
|
|
|
|
|
### 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
|
|
|
|
|
2022-06-25 00:58:18 +03:00
|
|
|
*Since: 20220624-141144-bd1b7c5d*
|
2022-05-07 05:47:42 +03:00
|
|
|
|
2022-09-11 21:57:48 +03:00
|
|
|
The key assignments for search mode are specified by the `search_mode` [Key Table](config/key-tables.md).
|
2022-05-07 05:47:42 +03:00
|
|
|
|
2022-09-07 20:17:01 +03:00
|
|
|
You may use
|
|
|
|
[wezterm.gui.default_key_tables](config/lua/wezterm.gui/default_key_tables.md)
|
|
|
|
to obtain the defaults and extend them. In earlier versions of wezterm there
|
|
|
|
wasn't a way to override portions of the key table, only to replace the entire
|
|
|
|
table.
|
2022-05-07 05:47:42 +03:00
|
|
|
|
2022-08-04 16:31:40 +03:00
|
|
|
The default configuration at the time that these docs were built (which
|
|
|
|
may be more recent than your version of wezterm) is shown below.
|
|
|
|
|
|
|
|
You can see the configuration in your version of wezterm by running
|
|
|
|
`wezterm show-keys --lua --key-table search_mode`.
|
2022-05-07 05:47:42 +03:00
|
|
|
|
2023-03-16 05:22:51 +03:00
|
|
|
{% include "examples/default-search-mode-key-table.markdown" %}
|
2022-05-07 05:47:42 +03:00
|
|
|
|
|
|
|
(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
|
2022-07-19 17:54:31 +03:00
|
|
|
local wezterm = require 'wezterm'
|
2020-05-30 21:35:53 +03:00
|
|
|
return {
|
|
|
|
keys = {
|
|
|
|
-- search for things that look like git hashes
|
2022-07-19 17:54:31 +03:00
|
|
|
{
|
|
|
|
key = 'H',
|
|
|
|
mods = 'SHIFT|CTRL',
|
|
|
|
action = wezterm.action.Search { Regex = '[a-f0-9]{6,}' },
|
|
|
|
},
|
2020-05-30 21:35:53 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2023-03-16 05:22:51 +03:00
|
|
|
See [the Search action docs](config/lua/keyassignment/Search.md) for more information on
|
2020-05-30 21:35:53 +03:00
|
|
|
using the `Search` action.
|