mirror of
https://github.com/wez/wezterm.git
synced 2024-12-22 12:51:31 +03:00
showkeys/docs: generate copy_mode defaults from the code
Uses `wezterm show-keys --lua --key-table copy_mode` to dump the actual copy mode key table. Include that in the docs. Same for search_mode.
This commit is contained in:
parent
9cce9ff81b
commit
3f7443f4c1
@ -478,12 +478,16 @@ _wezterm() {
|
||||
return 0
|
||||
;;
|
||||
wezterm__show__keys)
|
||||
opts="-h --help"
|
||||
opts="-h --lua --key-table --help"
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
fi
|
||||
case "${prev}" in
|
||||
--key-table)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
|
@ -39,6 +39,8 @@ complete -c wezterm -n "__fish_seen_subcommand_from connect" -s h -l help -d 'Pr
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from ls-fonts" -l text -d 'Explain which fonts are used to render the supplied text string' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from ls-fonts" -l list-system -d 'Whether to list all fonts available to the system'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from ls-fonts" -s h -l help -d 'Print help information'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from show-keys" -l key-table -d 'In lua mode, show only the named key table' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from show-keys" -l lua -d 'Show the keys as lua config statements'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from show-keys" -s h -l help -d 'Print help information'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -l class -d 'When connecting to a gui instance, if you started the gui with `--class SOMETHING`, you should also pass that same value here in order for the client to find the correct gui instance' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from list-clients; and not __fish_seen_subcommand_from proxy; and not __fish_seen_subcommand_from tlscreds; and not __fish_seen_subcommand_from move-pane-to-new-tab; and not __fish_seen_subcommand_from split-pane; and not __fish_seen_subcommand_from spawn; and not __fish_seen_subcommand_from send-text; and not __fish_seen_subcommand_from help" -l no-auto-start -d 'Don\'t automatically start the server'
|
||||
@ -80,9 +82,9 @@ complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcomm
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from split-pane" -s h -l help -d 'Print help information'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l pane-id -d 'Specify the current pane. The default is to use the current pane based on the environment variable WEZTERM_PANE. The pane is used to determine the current domain and window' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l domain-name -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l window-id -d 'Specify the window into which to spawn a tab. If omitted, the window associated with the current pane is used' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l window-id -d 'Specify the window into which to spawn a tab. If omitted, the window associated with the current pane is used. Cannot be used with `--workspace` or `--new-window`' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l cwd -d 'Specify the current working directory for the initially spawned program' -r -f -a "(__fish_complete_directories)"
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l workspace -d 'When creating a new window, override the default workspace name with the provided name. The default name is "default"' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l workspace -d 'When creating a new window, override the default workspace name with the provided name. The default name is "default". Requires `--new-window`' -r
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -l new-window -d 'Spawn into a new window, rather than a new tab'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from spawn" -s h -l help -d 'Print help information'
|
||||
complete -c wezterm -n "__fish_seen_subcommand_from cli; and __fish_seen_subcommand_from send-text" -l pane-id -d 'Specify the target pane. The default is to use the current pane based on the environment variable WEZTERM_PANE' -r
|
||||
|
@ -88,6 +88,8 @@ _arguments "${_arguments_options[@]}" \
|
||||
;;
|
||||
(show-keys)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--key-table=[In lua mode, show only the named key table]:KEY_TABLE: ' \
|
||||
'--lua[Show the keys as lua config statements]' \
|
||||
'-h[Print help information]' \
|
||||
'--help[Print help information]' \
|
||||
&& ret=0
|
||||
@ -167,10 +169,10 @@ _arguments "${_arguments_options[@]}" \
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--pane-id=[Specify the current pane. The default is to use the current pane based on the environment variable WEZTERM_PANE. The pane is used to determine the current domain and window]:PANE_ID: ' \
|
||||
'--domain-name=[]:DOMAIN_NAME: ' \
|
||||
'--window-id=[Specify the window into which to spawn a tab. If omitted, the window associated with the current pane is used]:WINDOW_ID: ' \
|
||||
'(--workspace --new-window)--window-id=[Specify the window into which to spawn a tab. If omitted, the window associated with the current pane is used. Cannot be used with `--workspace` or `--new-window`]:WINDOW_ID: ' \
|
||||
'--cwd=[Specify the current working directory for the initially spawned program]:CWD:_files -/' \
|
||||
'--workspace=[When creating a new window, override the default workspace name with the provided name. The default name is "default"]:WORKSPACE: ' \
|
||||
'(--window-id)--new-window[Spawn into a new window, rather than a new tab]' \
|
||||
'--workspace=[When creating a new window, override the default workspace name with the provided name. The default name is "default". Requires `--new-window`]:WORKSPACE: ' \
|
||||
'--new-window[Spawn into a new window, rather than a new tab]' \
|
||||
'-h[Print help information]' \
|
||||
'--help[Print help information]' \
|
||||
'*::prog -- Instead of executing your shell, run PROG. For example\: `wezterm cli spawn -- bash -l` will spawn bash as if it were a login shell:_cmdambivalent' \
|
||||
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
for shell in bash zsh fish ; do
|
||||
target/debug/wezterm shell-completion --shell $shell > assets/shell-completion/$shell
|
||||
done
|
17
ci/update-derived-files.sh
Executable file
17
ci/update-derived-files.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Update files that are derived from things baked into the executable
|
||||
|
||||
for shell in bash zsh fish ; do
|
||||
target/debug/wezterm shell-completion --shell $shell > assets/shell-completion/$shell
|
||||
done
|
||||
|
||||
for mode in copy_mode search_mode ; do
|
||||
fname="docs/examples/default-$(echo $mode | tr _ -)-key-table.markdown"
|
||||
# Make a wrapped up version of this as markdown, as
|
||||
# gelatyx doesn't understand the file include mechanism
|
||||
# when used in a lua block
|
||||
echo "\`\`\`lua" > $fname
|
||||
target/debug/wezterm -n show-keys --lua --key-table $mode >> $fname
|
||||
echo "\`\`\`" >> $fname
|
||||
done
|
204
docs/copymode.md
204
docs/copymode.md
@ -80,206 +80,4 @@ There isn't a way to override portions of the key table, only to replace the ent
|
||||
|
||||
The default configuration is equivalent to:
|
||||
|
||||
```lua
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
return {
|
||||
key_tables = {
|
||||
copy_mode = {
|
||||
{ key = 'c', mods = 'CTRL', action = act.CopyMode 'Close' },
|
||||
{ key = 'g', mods = 'CTRL', action = act.CopyMode 'Close' },
|
||||
{ key = 'q', mods = 'NONE', action = act.CopyMode 'Close' },
|
||||
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
|
||||
|
||||
{ key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
|
||||
{ key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
|
||||
{ key = 'k', mods = 'NONE', action = act.CopyMode 'MoveUp' },
|
||||
{ key = 'l', mods = 'NONE', action = act.CopyMode 'MoveRight' },
|
||||
|
||||
{ key = 'LeftArrow', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
|
||||
{ key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'MoveDown' },
|
||||
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'MoveUp' },
|
||||
{
|
||||
key = 'RightArrow',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveRight',
|
||||
},
|
||||
|
||||
{
|
||||
key = 'RightArrow',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveForwardWord',
|
||||
},
|
||||
{
|
||||
key = 'f',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveForwardWord',
|
||||
},
|
||||
{
|
||||
key = 'Tab',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveForwardWord',
|
||||
},
|
||||
{
|
||||
key = 'w',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveForwardWord',
|
||||
},
|
||||
|
||||
{
|
||||
key = 'LeftArrow',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveBackwardWord',
|
||||
},
|
||||
{
|
||||
key = 'b',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveBackwardWord',
|
||||
},
|
||||
{
|
||||
key = 'Tab',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveBackwardWord',
|
||||
},
|
||||
{
|
||||
key = 'b',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveBackwardWord',
|
||||
},
|
||||
|
||||
{
|
||||
key = '0',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToStartOfLine',
|
||||
},
|
||||
{
|
||||
key = 'Enter',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToStartOfNextLine',
|
||||
},
|
||||
|
||||
{
|
||||
key = '$',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToEndOfLineContent',
|
||||
},
|
||||
{
|
||||
key = '$',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToEndOfLineContent',
|
||||
},
|
||||
{
|
||||
key = '^',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToStartOfLineContent',
|
||||
},
|
||||
{
|
||||
key = '^',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToStartOfLineContent',
|
||||
},
|
||||
{
|
||||
key = 'm',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveToStartOfLineContent',
|
||||
},
|
||||
|
||||
{
|
||||
key = ' ',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode { SetSelectionMode = 'Cell' },
|
||||
},
|
||||
{
|
||||
key = 'v',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode { SetSelectionMode = 'Cell' },
|
||||
},
|
||||
{
|
||||
key = 'V',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode { SetSelectionMode = 'Line' },
|
||||
},
|
||||
{
|
||||
key = 'V',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode { SetSelectionMode = 'Line' },
|
||||
},
|
||||
{
|
||||
key = 'v',
|
||||
mods = 'CTRL',
|
||||
action = act.CopyMode { SetSelectionMode = 'Block' },
|
||||
},
|
||||
|
||||
{
|
||||
key = 'G',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToScrollbackBottom',
|
||||
},
|
||||
{
|
||||
key = 'G',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToScrollbackBottom',
|
||||
},
|
||||
{
|
||||
key = 'g',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToScrollbackTop',
|
||||
},
|
||||
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToViewportTop',
|
||||
},
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToViewportTop',
|
||||
},
|
||||
{
|
||||
key = 'M',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToViewportMiddle',
|
||||
},
|
||||
{
|
||||
key = 'M',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToViewportMiddle',
|
||||
},
|
||||
{
|
||||
key = 'L',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToViewportBottom',
|
||||
},
|
||||
{
|
||||
key = 'L',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToViewportBottom',
|
||||
},
|
||||
|
||||
{
|
||||
key = 'o',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToSelectionOtherEnd',
|
||||
},
|
||||
{
|
||||
key = 'O',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToSelectionOtherEndHoriz',
|
||||
},
|
||||
{
|
||||
key = 'O',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToSelectionOtherEndHoriz',
|
||||
},
|
||||
|
||||
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
|
||||
{ key = 'PageDown', mods = 'NONE', action = act.CopyMode 'PageDown' },
|
||||
|
||||
{ key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
|
||||
{ key = 'f', mods = 'CTRL', action = act.CopyMode 'PageDown' },
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
{{#include examples/default-copy-mode-key-table.markdown}}
|
||||
|
183
docs/examples/default-copy-mode-key-table.markdown
Normal file
183
docs/examples/default-copy-mode-key-table.markdown
Normal file
@ -0,0 +1,183 @@
|
||||
```lua
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
return {
|
||||
key_tables = {
|
||||
copy_mode = {
|
||||
{
|
||||
key = 'Tab',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveForwardWord',
|
||||
},
|
||||
{
|
||||
key = 'Tab',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveBackwardWord',
|
||||
},
|
||||
{
|
||||
key = 'Enter',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToStartOfNextLine',
|
||||
},
|
||||
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
|
||||
{
|
||||
key = 'Space',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode { SetSelectionMode = 'Cell' },
|
||||
},
|
||||
{
|
||||
key = '$',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToEndOfLineContent',
|
||||
},
|
||||
{
|
||||
key = '$',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToEndOfLineContent',
|
||||
},
|
||||
{
|
||||
key = '0',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToStartOfLine',
|
||||
},
|
||||
{
|
||||
key = 'G',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToScrollbackBottom',
|
||||
},
|
||||
{
|
||||
key = 'G',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToScrollbackBottom',
|
||||
},
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToViewportTop',
|
||||
},
|
||||
{
|
||||
key = 'H',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToViewportTop',
|
||||
},
|
||||
{
|
||||
key = 'L',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToViewportBottom',
|
||||
},
|
||||
{
|
||||
key = 'L',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToViewportBottom',
|
||||
},
|
||||
{
|
||||
key = 'M',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToViewportMiddle',
|
||||
},
|
||||
{
|
||||
key = 'M',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToViewportMiddle',
|
||||
},
|
||||
{
|
||||
key = 'O',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToSelectionOtherEndHoriz',
|
||||
},
|
||||
{
|
||||
key = 'O',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToSelectionOtherEndHoriz',
|
||||
},
|
||||
{
|
||||
key = 'V',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode { SetSelectionMode = 'Line' },
|
||||
},
|
||||
{
|
||||
key = 'V',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode { SetSelectionMode = 'Line' },
|
||||
},
|
||||
{
|
||||
key = '^',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToStartOfLineContent',
|
||||
},
|
||||
{
|
||||
key = '^',
|
||||
mods = 'SHIFT',
|
||||
action = act.CopyMode 'MoveToStartOfLineContent',
|
||||
},
|
||||
{ key = 'b', mods = 'NONE', action = act.CopyMode 'MoveBackwardWord' },
|
||||
{ key = 'b', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
|
||||
{ key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
|
||||
{ key = 'c', mods = 'CTRL', action = act.CopyMode 'Close' },
|
||||
{ key = 'f', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
|
||||
{ key = 'f', mods = 'CTRL', action = act.CopyMode 'PageDown' },
|
||||
{
|
||||
key = 'g',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToScrollbackTop',
|
||||
},
|
||||
{ key = 'g', mods = 'CTRL', action = act.CopyMode 'Close' },
|
||||
{ key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
|
||||
{ key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
|
||||
{ key = 'k', mods = 'NONE', action = act.CopyMode 'MoveUp' },
|
||||
{ key = 'l', mods = 'NONE', action = act.CopyMode 'MoveRight' },
|
||||
{
|
||||
key = 'm',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveToStartOfLineContent',
|
||||
},
|
||||
{
|
||||
key = 'o',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveToSelectionOtherEnd',
|
||||
},
|
||||
{ key = 'q', mods = 'NONE', action = act.CopyMode 'Close' },
|
||||
{
|
||||
key = 'v',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode { SetSelectionMode = 'Cell' },
|
||||
},
|
||||
{
|
||||
key = 'v',
|
||||
mods = 'CTRL',
|
||||
action = act.CopyMode { SetSelectionMode = 'Block' },
|
||||
},
|
||||
{ key = 'w', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
|
||||
{
|
||||
key = 'y',
|
||||
mods = 'NONE',
|
||||
action = act.Multiple {
|
||||
{ CopyTo = 'ClipboardAndPrimarySelection' },
|
||||
{ CopyMode = 'Close' },
|
||||
},
|
||||
},
|
||||
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
|
||||
{ key = 'PageDown', mods = 'NONE', action = act.CopyMode 'PageDown' },
|
||||
{ key = 'LeftArrow', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
|
||||
{
|
||||
key = 'LeftArrow',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveBackwardWord',
|
||||
},
|
||||
{
|
||||
key = 'RightArrow',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'MoveRight',
|
||||
},
|
||||
{
|
||||
key = 'RightArrow',
|
||||
mods = 'ALT',
|
||||
action = act.CopyMode 'MoveForwardWord',
|
||||
},
|
||||
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'MoveUp' },
|
||||
{ key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'MoveDown' },
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
33
docs/examples/default-search-mode-key-table.markdown
Normal file
33
docs/examples/default-search-mode-key-table.markdown
Normal file
@ -0,0 +1,33 @@
|
||||
```lua
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
return {
|
||||
key_tables = {
|
||||
search_mode = {
|
||||
{ key = 'Enter', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
|
||||
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
|
||||
{ key = 'n', mods = 'CTRL', action = act.CopyMode 'NextMatch' },
|
||||
{ key = 'p', mods = 'CTRL', action = act.CopyMode 'PriorMatch' },
|
||||
{ key = 'r', mods = 'CTRL', action = act.CopyMode 'CycleMatchType' },
|
||||
{ key = 'u', mods = 'CTRL', action = act.CopyMode 'ClearPattern' },
|
||||
{
|
||||
key = 'PageUp',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'PriorMatchPage',
|
||||
},
|
||||
{
|
||||
key = 'PageDown',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'NextMatchPage',
|
||||
},
|
||||
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
|
||||
{
|
||||
key = 'DownArrow',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'NextMatch',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
@ -96,39 +96,7 @@ There isn't a way to override portions of the key table, only to replace the ent
|
||||
|
||||
The default configuration is equivalent to:
|
||||
|
||||
```lua
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
return {
|
||||
key_tables = {
|
||||
search_mode = {
|
||||
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
|
||||
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
|
||||
{ key = 'Enter', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
|
||||
{ key = 'p', mods = 'CTRL', action = act.CopyMode 'PriorMatch' },
|
||||
{
|
||||
key = 'PageUp',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'PriorMatchPage',
|
||||
},
|
||||
{
|
||||
key = 'PageDown',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'NextMatchPage',
|
||||
},
|
||||
{ key = 'n', mods = 'CTRL', action = act.CopyMode 'NextMatchPage' },
|
||||
{
|
||||
key = 'DownArrow',
|
||||
mods = 'NONE',
|
||||
action = act.CopyMode 'NextMatch',
|
||||
},
|
||||
{ key = 'r', mods = 'CTRL', action = act.CopyMode 'CycleMatchType' },
|
||||
{ key = 'u', mods = 'CTRL', action = act.CopyMode 'ClearPattern' },
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
{{#include examples/default-search-mode-key-table.markdown}}
|
||||
|
||||
(Those assignments reference `CopyMode` because search mode is a facet of [Copy Mode](copymode.md)).
|
||||
|
||||
|
@ -338,6 +338,9 @@ pub struct LsFontsCommand {
|
||||
#[derive(Debug, Parser, Clone)]
|
||||
pub struct ShowKeysCommand {
|
||||
/// Show the keys as lua config statements
|
||||
#[clap(long = "lua")]
|
||||
#[clap(long)]
|
||||
pub lua: bool,
|
||||
/// In lua mode, show only the named key table
|
||||
#[clap(long)]
|
||||
pub key_table: Option<String>,
|
||||
}
|
||||
|
@ -391,20 +391,28 @@ impl InputMap {
|
||||
self.mouse.get(&(event, mods)).cloned()
|
||||
}
|
||||
|
||||
pub fn dump_config(&self) {
|
||||
pub fn dump_config(&self, key_table: Option<&str>) {
|
||||
println!("local wezterm = require 'wezterm'");
|
||||
println!("local act = wezterm.action");
|
||||
println!();
|
||||
println!("return {{");
|
||||
println!(" keys = {{");
|
||||
show_key_table_as_lua(&self.keys.default, 4);
|
||||
println!(" }},");
|
||||
|
||||
if key_table.is_none() {
|
||||
println!(" keys = {{");
|
||||
show_key_table_as_lua(&self.keys.default, 4);
|
||||
println!(" }},");
|
||||
println!();
|
||||
}
|
||||
|
||||
let mut table_names = self.keys.by_name.keys().collect::<Vec<_>>();
|
||||
table_names.sort();
|
||||
println!();
|
||||
println!(" key_tables = {{");
|
||||
for name in table_names {
|
||||
if let Some(wanted_table) = key_table {
|
||||
if name != wanted_table {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if let Some(table) = self.keys.by_name.get(name) {
|
||||
println!(" {name} = {{");
|
||||
show_key_table_as_lua(table, 6);
|
||||
|
@ -742,7 +742,7 @@ fn maybe_show_configuration_error_window() {
|
||||
fn run_show_keys(config: config::ConfigHandle, cmd: &ShowKeysCommand) -> anyhow::Result<()> {
|
||||
let map = crate::inputmap::InputMap::new(&config);
|
||||
if cmd.lua {
|
||||
map.dump_config();
|
||||
map.dump_config(cmd.key_table.as_deref());
|
||||
} else {
|
||||
map.show_keys();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user