Skip to content

Commit

Permalink
docs: document copy_mode and search_mode key tables
Browse files Browse the repository at this point in the history
refs: wez#993
  • Loading branch information
wez committed May 7, 2022
1 parent 89e427b commit 4cbd185
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
76 changes: 76 additions & 0 deletions docs/copymode.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,79 @@ reassignable.
| Move down one screen | `PageDown` |
| | `CTRL-f` |

### Configurable Key Assignments

*Since: nightly builds only*

The key assignments for copy mode are specified by the `copy_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 = {
copy_mode = {
{key="c", mods="CTRL", action=wezterm.action{CopyMode="Close"}},
{key="g", mods="CTRL", action=wezterm.action{CopyMode="Close"}},
{key="q", mods="NONE", action=wezterm.action{CopyMode="Close"}},
{key="Escape", mods="NONE", action=wezterm.action{CopyMode="Close"}},

{key="h", mods="NONE", action=wezterm.action{CopyMode="MoveLeft"}},
{key="j", mods="NONE", action=wezterm.action{CopyMode="MoveDown"}},
{key="k", mods="NONE", action=wezterm.action{CopyMode="MoveUp"}},
{key="l", mods="NONE", action=wezterm.action{CopyMode="MoveRight"}},

{key="LeftArrow", mods="NONE", action=wezterm.action{CopyMode="MoveLeft"}},
{key="DownArrow", mods="NONE", action=wezterm.action{CopyMode="MoveDown"}},
{key="UpArrow", mods="NONE", action=wezterm.action{CopyMode="MoveUp"}},
{key="RightArrow", mods="NONE", action=wezterm.action{CopyMode="MoveRight"}},

{key="RightArrow", mods="ALT", action=wezterm.action{CopyMode="MoveForwardWord"}},
{key="f", mods="ALT", action=wezterm.action{CopyMode="MoveForwardWord"}},
{key="Tab", mods="NONE", action=wezterm.action{CopyMode="MoveForwardWord"}},
{key="w", mods="NONE", action=wezterm.action{CopyMode="MoveForwardWord"}},

{key="LeftArrow", mods="ALT", action=wezterm.action{CopyMode="MoveBackwardWord"}},
{key="b", mods="ALT", action=wezterm.action{CopyMode="MoveBackwardWord"}},
{key="Tab", mods="SHIFT", action=wezterm.action{CopyMode="MoveBackwardWord"}},
{key="b", mods="NONE", action=wezterm.action{CopyMode="MoveBackwardWord"}},

{key="0", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfLine"}},
{key="Enter", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfNextLine"}},
{key="$", mods="NONE", action=wezterm.action{CopyMode="MoveToEndOfLineContent"}},
{key="$", mods="SHIFT", action=wezterm.action{CopyMode="MoveToEndOfLineContent"}},

{key="m", mods="ALT", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}},
{key="^", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}},
{key="^", mods="SHIFT", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}},

{key=" ", mods="NONE", action=wezterm.action{CopyMode="ToggleSelectionByCell"}},
{key="v", mods="NONE", action=wezterm.action{CopyMode="ToggleSelectionByCell"}},
{key="v", mods="CTRL", action=wezterm.action{CopyMode={SetSelectionMode="Block"}}},

{key="G", mods="NONE", action=wezterm.action{CopyMode="MoveToScrollbackBottom"}},
{key="G", mods="SHIFT", action=wezterm.action{CopyMode="MoveToScrollbackBottom"}},
{key="g", mods="NONE", action=wezterm.action{CopyMode="MoveToScrollbackTop"}},

{key="H", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportTop"}},
{key="H", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportTop"}},
{key="M", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportMiddle"}},
{key="M", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportMiddle"}},
{key="L", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportBottom"}},
{key="L", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportBottom"}},

{key="PageUp", mods="NONE", action=wezterm.action{CopyMode="PageUp"}},
{key="PageDown", mods="NONE", action=wezterm.action{CopyMode="PageDown"}},

{key="b", mods="CTRL", action=wezterm.action{CopyMode="PageUp"}},
{key="f", mods="CTRL", action=wezterm.action{CopyMode="PageDown"}},
}
},
}
```

34 changes: 34 additions & 0 deletions docs/scrollback.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,40 @@ When the search overlay is active the behavior of wezterm changes:
* `Escape` will cancel the search overlay, leaving the currently selected text selected
with the viewport scrolled to that location.

#### 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)).

### Configuring Saved Searches

*since: 20200607-144723-74889cd4*
Expand Down

0 comments on commit 4cbd185

Please sign in to comment.