Add Multiple key assignment
refs: https://github.com/wez/wezterm/pull/1091
This commit is contained in:
1 parent
67e8bdc5c2
commit
4c8ccf8efc
6 files changed
+33
-2
No files matched your search
@@ -205,6 +205,8 @@ pub enum KeyAssignment {
|
||||
CloseCurrentPane { confirm: bool },
|
||||
EmitEvent(String),
|
||||
QuickSelect,
|
||||
|
||||
Multiple(Vec<KeyAssignment>),
|
||||
}
|
||||
impl_lua_conversion!(KeyAssignment);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* New: Added [SendKey](config/lua/keyassignment/SendKey.md) key assignment action that makes it more convenient to rebind the key input that is sent to a pane.
|
||||
* Fixed: Crash due to Out of Memory condition when the iTerm2 protocol was used to send excessively large PNG files [#1031](https://github.com/wez/wezterm/issues/1031)
|
||||
* Fixed: `DCH` sequence would remove cells and replace them with default-blank cells instead of blank-cells-with-current-bg-color. [#789](https://github.com/wez/wezterm/issues/789)
|
||||
* New: Added [Multiple](config/lua/keyassignment/Multiple.md) key assignment action for combining multuple actions in a single press.
|
||||
|
||||
### 20210814-124438-54e29167
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# Multiple
|
||||
|
||||
*Since: nightly builds only*
|
||||
|
||||
Performs a sequence of multiple assignments. This is useful when you
|
||||
want a single key press to trigger multiple actions.
|
||||
|
||||
The example below causes `LeftArrow` to effectively type `left`:
|
||||
|
||||
```lua
|
||||
return {
|
||||
keys = {
|
||||
{key="LeftArrow", action={Multiple={
|
||||
{SendKey={key="l"}},
|
||||
{SendKey={key="e"}},
|
||||
{SendKey={key="f"}},
|
||||
{SendKey={key="t"}},
|
||||
}}}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -18,7 +18,6 @@ shells and applications.
|
||||
The following configuration achieves that same effect:
|
||||
|
||||
```lua
|
||||
local wezterm = require 'wezterm';
|
||||
return {
|
||||
keys = {
|
||||
-- Rebind OPT-Left, OPT-Right as ALT-b, ALT-f respectively to match Terminal.app behavior
|
||||
@@ -27,3 +26,5 @@ return {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See also [Multiple](Multiple.md) for combining multiple actions in a single press.
|
||||
@@ -32,4 +32,5 @@ return {
|
||||
}
|
||||
```
|
||||
|
||||
See also [SendKey](SendKey.md) which makes the example above much more convenient.
|
||||
See also [SendKey](SendKey.md) which makes the example above much more convenient,
|
||||
and [Multiple](Multiple.md) for combining multiple actions in a single press.
|
||||
@@ -1669,6 +1669,11 @@ impl TermWindow {
|
||||
let window = self.window.as_ref().map(|w| w.clone());
|
||||
|
||||
match assignment {
|
||||
Multiple(actions) => {
|
||||
for a in actions {
|
||||
self.perform_key_assignment(pane, a)?;
|
||||
}
|
||||
}
|
||||
SpawnTab(spawn_where) => {
|
||||
self.spawn_tab(spawn_where);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user