Add wezterm.gui.default_key_tables()
This provides a means for more easily extending the default key tables without forcing the user to recreate the entire config for themselves. wezterm.gui.default_keys is also added by this, but it is likely not as useful.
This commit is contained in:
1 parent
cd2c2a1a83
commit
c0fff4e843
8 files changed
+112
-4
No files matched your search
@@ -11,6 +11,11 @@ usually the best available version.
|
||||
|
||||
As features stabilize some brief notes about them will accumulate here.
|
||||
|
||||
#### New
|
||||
* [wezterm.gui.default_key_tables](config/lua/wezterm.gui/default_key_tables.md)
|
||||
and [wezterm.gui.default_keys](config/lua/wezterm.gui/default_keys.md) for
|
||||
more conveniently copying and extending the default configuration.
|
||||
|
||||
#### Fixed
|
||||
* Wayland: key repeat gets stuck after pressing two keys in quick succession.
|
||||
Thanks to [@unrelentingtech](https://github.com/unrelentingtech)!
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# `wezterm.gui.default_key_tables()`
|
||||
|
||||
*Since: nightly builds only*
|
||||
|
||||
Returns a table holding the effective default set of `key_tables`. That is the
|
||||
set of keys that is used as a base if there was no configuration file.
|
||||
|
||||
This is useful in cases where you want to override a key table assignment
|
||||
without replacing the entire set of key tables.
|
||||
|
||||
This example shows how to add a key assignment for `Backspace` to `copy_mode`,
|
||||
without having to manually specify the entire key table:
|
||||
|
||||
```lua
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
local copy_mode = nil
|
||||
if wezterm.gui then
|
||||
copy_mode = wezterm.gui.default_key_tables().copy_mode
|
||||
table.insert(
|
||||
copy_mode,
|
||||
{ key = 'Backspace', mods = 'NONE', action = act.CopyMode 'MoveLeft' }
|
||||
)
|
||||
end
|
||||
|
||||
return {
|
||||
key_tables = {
|
||||
copy_mode = copy_mode,
|
||||
},
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
# `wezterm.gui.default_keys()`
|
||||
|
||||
*Since: nightly builds only*
|
||||
|
||||
Returns a table holding the effective default values for key assignments. That
|
||||
is the set of keys that is used as a base if there was no configuration file.
|
||||
|
||||
|
||||
+8
-2
@@ -75,8 +75,14 @@ reassignable.
|
||||
|
||||
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.
|
||||
You may provide your own definition of this key table if you wish to customize
|
||||
it.
|
||||
|
||||
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.
|
||||
|
||||
The default configuration at the time that these docs were built (which
|
||||
may be more recent than your version of wezterm) is shown below.
|
||||
|
||||
+5
-2
@@ -91,8 +91,11 @@ When the search overlay is active the behavior of wezterm changes:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
The default configuration at the time that these docs were built (which
|
||||
may be more recent than your version of wezterm) is shown below.
|
||||
|
||||
Reference in new issue
Block a user