docs: split out the KeyAssignment enum variants

This makes the individual functions a bit easier to discover,
and a lot easier to link to.
This commit is contained in:
Wez Furlong committed 2020-10-10 08:45:13 -07:00
1 parent 7af4152275
commit 809bb53387
39 files changed
+623 -526

No files matched your search

+1
View File
@@ -14,6 +14,7 @@
/docs/config/lua/wezterm/index.md
/docs/config/lua/pane/index.md
/docs/config/lua/window/index.md
/docs/config/lua/keyassignment/index.md
**/*.rs.bk
.*.sw*
/esctest.log
+41 -6
View File
@@ -91,7 +91,10 @@ TOC = [
"Lua Reference",
"config/lua/general.md",
children=[
Gen("module: wezterm", "config/lua/wezterm", index="""
Gen(
"module: wezterm",
"config/lua/wezterm",
index="""
# `require wezterm`
The wezterm module is the primary module that exposes wezterm configuration
@@ -106,8 +109,35 @@ local wezterm = require 'wezterm';
at the top of your configuration file to enable it.
## Available functions, constants
"""),
Gen("object: Pane", "config/lua/pane", index="""
""",
),
Gen(
"enum: KeyAssignment",
"config/lua/keyassignment",
index="""
# `KeyAssignment` enumeration
A `KeyAssignment` represents a pre-defined function that can be applied
to control the Window, Tab, Pane state typically when a key or mouse event
is triggered.
Internally, in the underlying Rust code, `KeyAssignment` is an enum
type with a variant for each possible action known to wezterm. In Lua,
enums get represented as a table with a single key corresponding to
the variant name.
In most cases the [`wezterm.action`](../wezterm/action.md) function is
used to create an instance of `KeyAssignment` and make it a bit more
clear and convenient.
## Available Key Assignments
""",
),
Gen(
"object: Pane",
"config/lua/pane",
index="""
# `Pane` object
A Pane object cannot be created in lua code; it is typically passed to your
@@ -121,8 +151,12 @@ introspect the state of the terminal emulation for that pane.
## Available methods
"""),
Gen("object: Window", "config/lua/window", index="""
""",
),
Gen(
"object: Window",
"config/lua/window",
index="""
# `Window` object
A Window object cannot be created in lua code; it is typically passed to
@@ -131,7 +165,8 @@ TermWindow running in the wezterm process.
## Available methods
"""),
""",
),
],
),
],
+3 -514
View File
@@ -289,519 +289,8 @@ Possible Modifier labels are:
You can combine modifiers using the `|` symbol (eg: `"CMD|CTRL"`).
# Possible Actions
# Available Actions
Possible actions are listed below.
See the [`KeyAssignment` reference](lua/keyassignment/index.md) for information
on available actions.
## SpawnTab
Create a new tab in the current window. The argument defines to which *domain* the tab belongs:
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- Create a new tab in the default domain
{key="t", mods="SHIFT|ALT", action=wezterm.action{SpawnTab="DefaultDomain"}},
-- Create a new tab in the same domain as the current tab
{key="t", mods="SHIFT|ALT", action=wezterm.action{SpawnTab="CurrentPaneDomain"}},
-- Create a tab in a named domain
{key="t", mods="SHIFT|ALT", action=wezterm.action{SpawnTab={DomainName="unix"}}},
}
}
```
## SpawnWindow
Create a new window containing a tab from the default tab domain.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="n", mods="SHIFT|CTRL", action="SpawnWindow"},
}
}
```
## SpawnCommandInNewWindow / SpawnCommandInNewTab
Spawn a new tab either into the current window or into a brand new window.
The argument controls which command is run in the tab; it is a lua table
with the following fields:
* `args` - the argument array specifying the command and its arguments.
If omitted, the default program will be run.
* `cwd` - the current working directory to set for the command.
* `set_environment_variables` - a table specifying key/value pairs to
set in the environment
* `domain` - specifies the domain into which the tab will be spawned.
See `SpawnTab` for examples.
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- CMD-y starts `top` in a new window
{key="y", mods="CMD", action=wezterm.action{SpawnCommandInNewWindow={
args={"top"}
}}},
}
}
```
## ToggleFullScreen
Toggles full screen mode for the current window. (But see:
<https://github.com/wez/wezterm/issues/177>)
```lua
return {
keys = {
{key="n", mods="SHIFT|CTRL", action="ToggleFullScreen"},
}
}
```
## Copy
Copy the selection to the clipboard. On X11 systems, this populates both the
Clipboard and the Primary Selection.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="c", mods="SHIFT|CTRL", action="Copy"},
}
}
```
## Paste
Paste the clipboard to the current tab. On X11 systems, this copies from the
Clipboard rather than the Primary Selection. See also `PastePrimarySelection`.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="v", mods="SHIFT|CTRL", action="Paste"},
}
}
```
## PastePrimarySelection
X11: Paste the Primary Selection to the current tab.
On other systems, this behaves identically to `Paste`.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="v", mods="SHIFT|CTRL", action="PastePrimarySelection"},
}
}
```
## ActivateTabRelative
Activate a tab relative to the current tab. The argument value specifies an
offset. eg: `-1` activates the tab to the left of the current tab, while `1`
activates the tab to the right.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="{", mods="SHIFT|ALT", action=wezterm.action{ActivateTabRelative=-1}},
{key="}", mods="SHIFT|ALT", action=wezterm.action{ActivateTabRelative=1}},
}
}
```
## ActivateTab
Activate the tab specified by the argument value. eg: `0` activates the
leftmost tab, while `1` activates the second tab from the left, and so on.
*since: 20200620-160318-e00b076c*
`ActivateTab` now accepts negative numbers; these wrap around from the start
of the tabs to the end, so `-1` references the right-most tab, `-2` the tab
to its left and so on.
```lua
local wezterm = require 'wezterm';
local mykeys = {}
for i = 1, 8 do
-- CTRL+ALT + number to activate that tab
table.insert(mykeys, {
key=tostring(i),
mods="CTRL|ALT",
action=wezterm.action{ActivateTab=i-1},
})
-- F1 through F8 to activate that tab
table.insert(mykeys, {
key="F" .. tostring(i),
action=wezterm.action{ActivateTab=i-1},
})
end
return {
keys = mykeys,
}
```
## IncreaseFontSize
Increases the font size of the current window by 10%
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="=", mods="CTRL", action="IncreaseFontSize"},
}
}
```
## DecreaseFontSize
Decreases the font size of the current window by 10%
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="-", mods="CTRL", action="DecreaseFontSize"},
}
}
```
## ResetFontSize
Reset the font size for the current window to the value in your configuration
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="0", mods="CTRL", action="ResetFontSize"},
}
}
```
## SendString
Sends the string specified argument to the terminal in the current tab, as
though that text were literally typed into the terminal.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="m", mods="CMD", action=wezterm.action{SendString="Hello"}},
}
}
```
You can also emit escape sequences using `SendString`. This example shows
how to bind Alt-LeftArrow/RightArrow to the Alt-b/f, an emacs style
keybinding for moving backwards/forwards through a word in a line editor.
`\x1b` is the ESC character:
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- Make Option-Left equivalent to Alt-b which many line editors interpret as backward-word
{key="LeftArrow", mods="OPT", action=wezterm.action{SendString="\x1bb"}},
-- Make Option-Right equivalent to Alt-f; forward-word
{key="RightArrow", mods="OPT", action=wezterm.action{SendString="\x1bf"}},
}
}
```
## DisableDefaultAssignment
Has no special meaning of its own; this action will undo the registration
of a default assignment if that key/mouse/modifier combination is one of the
default assignments and cause the key press to be propagated through
to the tab for processing.
```lua
return {
keys = {
-- Turn off the default CMD-m Hide action, allowing CMD-m to
-- be potentially recognized and handled by the tab
{key="m", mods="CMD", action="DisableDefaultAssignment"},
}
}
```
## Nop
Causes the key press to have no effect; it behaves as though those
keys were not pressed.
```lua
return {
keys = {
-- Turn off any side effects from pressing CMD-m
{key="m", mods="CMD", action="Nop"},
}
}
```
## Hide
Hides the current window
```lua
return {
keys = {
{key="h", mods="CMD", action="Hide"},
}
}
```
## HideApplication
On macOS, hide the WezTerm application.
```lua
return {
keys = {
{key="h", mods="CMD", action="HideApplication"},
}
}
```
## QuitApplication
Terminate the WezTerm application, killing all tabs.
```lua
return {
keys = {
{key="q", mods="CMD", action="QuitApplication"},
}
}
```
## Show
Shows the current window.
## CloseCurrentTab
Equivalent to clicking the `x` on the window title bar to close it: Closes the
current tab. If that was the last tab, closes that window. If that was the
last window, wezterm terminates.
```lua
return {
keys = {
{key="w", mods="CMD", action="CloseCurrentTab"},
}
}
```
## MoveTabRelative
Move the current tab relative to its peers. The argument specifies an
offset. eg: `-1` moves the tab to the left of the current tab, while `1` moves
the tab to the right.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="{", mods="SHIFT|ALT", action=wezterm.action{MoveTabRelative=-1}},
{key="}", mods="SHIFT|ALT", action=wezterm.action{MoveTabRelative=1}},
}
}
```
## MoveTab
Move the tab so that it has the index specified by the argument. eg: `0`
moves the tab to be leftmost, while `1` moves the tab so that it is second tab
from the left, and so on.
```lua
local wezterm = require 'wezterm';
local mykeys = {}
for i = 1, 8 do
-- CTRL+ALT + number to move to that position
table.insert(mykeys, {
key=tostring(i),
mods="CTRL|ALT",
action=wezterm.action{Move=i-1},
})
end
return {
keys = mykeys,
}
```
## ScrollByPage
Adjusts the scroll position by the number of pages specified by the argument.
Negative values scroll upwards, while positive values scroll downwards.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="PageUp", mods="SHIFT", action=wezterm.action{ScrollByPage=-1}},
{key="PageDown", mods="SHIFT", action=wezterm.action{ScrollByPage=1}},
}
}
```
## ClearScrollback
Clears the lines that have scrolled off the top of the viewport, resetting
the scrollbar thumb to the full height of the window.
```lua
return {
keys = {
{key="K", mods="CTRL|SHIFT", action="ClearScrollback"}
}
}
```
## ReloadConfiguration
Explicitly reload the configuration.
```lua
return {
keys = {
{key="r", mods="CMD|SHIFT", action="ReloadConfiguration"},
}
}
```
## ShowLauncher
Activate the [Launcher Menu](launch.html#the-launcher-menu)
in the current tab.
```lua
return {
keys = {
{key="l", mods="ALT", action="ShowLauncher"},
}
}
```
## ShowTabNavigator
Activate the tab navigator UI in the current tab. The tab
navigator displays a list of tabs and allows you to select
and activate a tab from that list.
```lua
return {
keys = {
{key="F9", mods="ALT", action="ShowTabNavigator"},
}
}
```
## SelectTextAtMouseCursor
Initiates selection of text at the current mouse cursor position.
The mode argument can be one of `Cell`, `Word` or `Line` to control
the scope of the selection.
## ExtendSelectionToMouseCursor
Extends the current text selection to the current mouse cursor position.
The mode argument can be one of `Cell`, `Word` or `Line` to control
the scope of the selection.
It is also possible to leave the mode unspecified like this:
```lua
return {
mouse_bindings = {
{
event={Up={streak=1, button="Left"}},
mods="SHIFT",
-- Note that there is no `wezterm.action` here
action={ExtendSelectionToMouseCursor={}},
},
}
}
```
when unspecified, wezterm will use a default mode which at the time
of writing is `Cell`, but in a future release may be context sensitive
based on recent actions.
## OpenLinkAtMouseCursor
If the current mouse cursor position is over a cell that contains
a hyperlink, this action causes that link to be opened.
## CompleteSelection
Completes an active text selection process; the selection range is
marked closed and then the selected text is copied as though the
`Copy` action was executed.
## CompleteSelectionOrOpenLinkAtMouseCursor
If a selection is in progress, acts as though `CompleteSelection` was
triggered. Otherwise acts as though `OpenLinkAtMouseCursor` was
triggered.
## Search
*since: 20200607-144723-74889cd4*
This action will trigger the search overlay for the current tab.
It accepts a typed pattern string as its parameter, allowing for
`Regex`, `CaseSensitiveString` and `CaseInSensitiveString` as
pattern matching types.
The supported [regular expression syntax is described
here](https://docs.rs/regex/1.3.9/regex/#syntax).
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- search for things that look like git hashes
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={Regex="[a-f0-9]{6,}"}}},
-- search for the lowercase string "hash" matching the case exactly
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={CaseSensitiveString="hash"}}},
-- search for the string "hash" matching regardless of case
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={CaseInSensitiveString="hash"}}},
},
}
```
## ActivateCopyMode
*since: 20200607-144723-74889cd4*
Activates copy mode!
[Learn more about copy mode](../copymode.html)
@@ -0,0 +1,8 @@
# ActivateCopyMode
*since: 20200607-144723-74889cd4*
Activates copy mode!
[Learn more about copy mode](../copymode.html)
@@ -0,0 +1,36 @@
# ActivateTab
Activate the tab specified by the argument value. eg: `0` activates the
leftmost tab, while `1` activates the second tab from the left, and so on.
*since: 20200620-160318-e00b076c*
`ActivateTab` now accepts negative numbers; these wrap around from the start
of the tabs to the end, so `-1` references the right-most tab, `-2` the tab
to its left and so on.
```lua
local wezterm = require 'wezterm';
local mykeys = {}
for i = 1, 8 do
-- CTRL+ALT + number to activate that tab
table.insert(mykeys, {
key=tostring(i),
mods="CTRL|ALT",
action=wezterm.action{ActivateTab=i-1},
})
-- F1 through F8 to activate that tab
table.insert(mykeys, {
key="F" .. tostring(i),
action=wezterm.action{ActivateTab=i-1},
})
end
return {
keys = mykeys,
}
```
@@ -0,0 +1,17 @@
# ActivateTabRelative
Activate a tab relative to the current tab. The argument value specifies an
offset. eg: `-1` activates the tab to the left of the current tab, while `1`
activates the tab to the right.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="{", mods="SHIFT|ALT", action=wezterm.action{ActivateTabRelative=-1}},
{key="}", mods="SHIFT|ALT", action=wezterm.action{ActivateTabRelative=1}},
}
}
```
@@ -0,0 +1,14 @@
# ClearScrollback
Clears the lines that have scrolled off the top of the viewport, resetting
the scrollbar thumb to the full height of the window.
```lua
return {
keys = {
{key="K", mods="CTRL|SHIFT", action="ClearScrollback"}
}
}
```
@@ -0,0 +1,15 @@
# CloseCurrentTab
Equivalent to clicking the `x` on the window title bar to close it: Closes the
current tab. If that was the last tab, closes that window. If that was the
last window, wezterm terminates.
```lua
return {
keys = {
{key="w", mods="CMD", action="CloseCurrentTab"},
}
}
```
@@ -0,0 +1,7 @@
# CompleteSelection
Completes an active text selection process; the selection range is
marked closed and then the selected text is copied as though the
`Copy` action was executed.
@@ -0,0 +1,7 @@
# CompleteSelectionOrOpenLinkAtMouseCursor
If a selection is in progress, acts as though `CompleteSelection` was
triggered. Otherwise acts as though `OpenLinkAtMouseCursor` was
triggered.
+15
View File
@@ -0,0 +1,15 @@
# Copy
Copy the selection to the clipboard. On X11 systems, this populates both the
Clipboard and the Primary Selection.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="c", mods="SHIFT|CTRL", action="Copy"},
}
}
```
@@ -0,0 +1,14 @@
# DecreaseFontSize
Decreases the font size of the current window by 10%
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="-", mods="CTRL", action="DecreaseFontSize"},
}
}
```
@@ -0,0 +1,18 @@
# DisableDefaultAssignment
Has no special meaning of its own; this action will undo the registration
of a default assignment if that key/mouse/modifier combination is one of the
default assignments and cause the key press to be propagated through
to the tab for processing.
```lua
return {
keys = {
-- Turn off the default CMD-m Hide action, allowing CMD-m to
-- be potentially recognized and handled by the tab
{key="m", mods="CMD", action="DisableDefaultAssignment"},
}
}
```
@@ -0,0 +1,26 @@
# ExtendSelectionToMouseCursor
Extends the current text selection to the current mouse cursor position.
The mode argument can be one of `Cell`, `Word` or `Line` to control
the scope of the selection.
It is also possible to leave the mode unspecified like this:
```lua
return {
mouse_bindings = {
{
event={Up={streak=1, button="Left"}},
mods="SHIFT",
-- Note that there is no `wezterm.action` here
action={ExtendSelectionToMouseCursor={}},
},
}
}
```
when unspecified, wezterm will use a default mode which at the time
of writing is `Cell`, but in a future release may be context sensitive
based on recent actions.
+13
View File
@@ -0,0 +1,13 @@
# Hide
Hides the current window
```lua
return {
keys = {
{key="h", mods="CMD", action="Hide"},
}
}
```
@@ -0,0 +1,13 @@
# HideApplication
On macOS, hide the WezTerm application.
```lua
return {
keys = {
{key="h", mods="CMD", action="HideApplication"},
}
}
```
@@ -0,0 +1,14 @@
# IncreaseFontSize
Increases the font size of the current window by 10%
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="=", mods="CTRL", action="IncreaseFontSize"},
}
}
```
+25
View File
@@ -0,0 +1,25 @@
# MoveTab
Move the tab so that it has the index specified by the argument. eg: `0`
moves the tab to be leftmost, while `1` moves the tab so that it is second tab
from the left, and so on.
```lua
local wezterm = require 'wezterm';
local mykeys = {}
for i = 1, 8 do
-- CTRL+ALT + number to move to that position
table.insert(mykeys, {
key=tostring(i),
mods="CTRL|ALT",
action=wezterm.action{Move=i-1},
})
end
return {
keys = mykeys,
}
```
@@ -0,0 +1,17 @@
# MoveTabRelative
Move the current tab relative to its peers. The argument specifies an
offset. eg: `-1` moves the tab to the left of the current tab, while `1` moves
the tab to the right.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="{", mods="SHIFT|ALT", action=wezterm.action{MoveTabRelative=-1}},
{key="}", mods="SHIFT|ALT", action=wezterm.action{MoveTabRelative=1}},
}
}
```
+15
View File
@@ -0,0 +1,15 @@
# Nop
Causes the key press to have no effect; it behaves as though those
keys were not pressed.
```lua
return {
keys = {
-- Turn off any side effects from pressing CMD-m
{key="m", mods="CMD", action="Nop"},
}
}
```
@@ -0,0 +1,6 @@
# OpenLinkAtMouseCursor
If the current mouse cursor position is over a cell that contains
a hyperlink, this action causes that link to be opened.
+15
View File
@@ -0,0 +1,15 @@
# Paste
Paste the clipboard to the current tab. On X11 systems, this copies from the
Clipboard rather than the Primary Selection. See also `PastePrimarySelection`.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="v", mods="SHIFT|CTRL", action="Paste"},
}
}
```
@@ -0,0 +1,15 @@
# PastePrimarySelection
X11: Paste the Primary Selection to the current tab.
On other systems, this behaves identically to `Paste`.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="v", mods="SHIFT|CTRL", action="PastePrimarySelection"},
}
}
```
@@ -0,0 +1,13 @@
# QuitApplication
Terminate the WezTerm application, killing all tabs.
```lua
return {
keys = {
{key="q", mods="CMD", action="QuitApplication"},
}
}
```
@@ -0,0 +1,13 @@
# ReloadConfiguration
Explicitly reload the configuration.
```lua
return {
keys = {
{key="r", mods="CMD|SHIFT", action="ReloadConfiguration"},
}
}
```
@@ -0,0 +1,14 @@
# ResetFontSize
Reset the font size for the current window to the value in your configuration
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="0", mods="CTRL", action="ResetFontSize"},
}
}
```
@@ -0,0 +1,17 @@
# ScrollByPage
Adjusts the scroll position by the number of pages specified by the argument.
Negative values scroll upwards, while positive values scroll downwards.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="PageUp", mods="SHIFT", action=wezterm.action{ScrollByPage=-1}},
{key="PageDown", mods="SHIFT", action=wezterm.action{ScrollByPage=1}},
}
}
```
+28
View File
@@ -0,0 +1,28 @@
# Search
*since: 20200607-144723-74889cd4*
This action will trigger the search overlay for the current tab.
It accepts a typed pattern string as its parameter, allowing for
`Regex`, `CaseSensitiveString` and `CaseInSensitiveString` as
pattern matching types.
The supported [regular expression syntax is described
here](https://docs.rs/regex/1.3.9/regex/#syntax).
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- search for things that look like git hashes
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={Regex="[a-f0-9]{6,}"}}},
-- search for the lowercase string "hash" matching the case exactly
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={CaseSensitiveString="hash"}}},
-- search for the string "hash" matching regardless of case
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={CaseInSensitiveString="hash"}}},
},
}
```
@@ -0,0 +1,7 @@
# SelectTextAtMouseCursor
Initiates selection of text at the current mouse cursor position.
The mode argument can be one of `Cell`, `Word` or `Line` to control
the scope of the selection.
@@ -0,0 +1,34 @@
# SendString
Sends the string specified argument to the terminal in the current tab, as
though that text were literally typed into the terminal.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="m", mods="CMD", action=wezterm.action{SendString="Hello"}},
}
}
```
You can also emit escape sequences using `SendString`. This example shows
how to bind Alt-LeftArrow/RightArrow to the Alt-b/f, an emacs style
keybinding for moving backwards/forwards through a word in a line editor.
`\x1b` is the ESC character:
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- Make Option-Left equivalent to Alt-b which many line editors interpret as backward-word
{key="LeftArrow", mods="OPT", action=wezterm.action{SendString="\x1bb"}},
-- Make Option-Right equivalent to Alt-f; forward-word
{key="RightArrow", mods="OPT", action=wezterm.action{SendString="\x1bf"}},
}
}
```
+4
View File
@@ -0,0 +1,4 @@
# Show
Shows the current window.
@@ -0,0 +1,14 @@
# ShowLauncher
Activate the [Launcher Menu](launch.html#the-launcher-menu)
in the current tab.
```lua
return {
keys = {
{key="l", mods="ALT", action="ShowLauncher"},
}
}
```
@@ -0,0 +1,15 @@
# ShowTabNavigator
Activate the tab navigator UI in the current tab. The tab
navigator displays a list of tabs and allows you to select
and activate a tab from that list.
```lua
return {
keys = {
{key="F9", mods="ALT", action="ShowTabNavigator"},
}
}
```
@@ -0,0 +1,28 @@
## SpawnCommandInNewTab
Spawn a new tab into the current window.
The argument controls which command is run in the tab; it is a lua table
with the following fields:
* `args` - the argument array specifying the command and its arguments.
If omitted, the default program will be run.
* `cwd` - the current working directory to set for the command.
* `set_environment_variables` - a table specifying key/value pairs to
set in the environment
* `domain` - specifies the domain into which the tab will be spawned.
See `SpawnTab` for examples.
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- CMD-y starts `top` in a new window
{key="y", mods="CMD", action=wezterm.action{SpawnCommandInNewWindow={
args={"top"}
}}},
}
}
```
@@ -0,0 +1,28 @@
# SpawnCommandInNewWindow
Spawn a new tab into a brand new window.
The argument controls which command is run in the tab; it is a lua table
with the following fields:
* `args` - the argument array specifying the command and its arguments.
If omitted, the default program will be run.
* `cwd` - the current working directory to set for the command.
* `set_environment_variables` - a table specifying key/value pairs to
set in the environment
* `domain` - specifies the domain into which the tab will be spawned.
See `SpawnTab` for examples.
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- CMD-y starts `top` in a new window
{key="y", mods="CMD", action=wezterm.action{SpawnCommandInNewWindow={
args={"top"}
}}},
}
}
```
+19
View File
@@ -0,0 +1,19 @@
# SpawnTab
Create a new tab in the current window. The argument defines to which *domain* the tab belongs:
```lua
local wezterm = require 'wezterm';
return {
keys = {
-- Create a new tab in the default domain
{key="t", mods="SHIFT|ALT", action=wezterm.action{SpawnTab="DefaultDomain"}},
-- Create a new tab in the same domain as the current tab
{key="t", mods="SHIFT|ALT", action=wezterm.action{SpawnTab="CurrentPaneDomain"}},
-- Create a tab in a named domain
{key="t", mods="SHIFT|ALT", action=wezterm.action{SpawnTab={DomainName="unix"}}},
}
}
```
@@ -0,0 +1,14 @@
# SpawnWindow
Create a new window containing a tab from the default tab domain.
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="n", mods="SHIFT|CTRL", action="SpawnWindow"},
}
}
```
@@ -0,0 +1,14 @@
# ToggleFullScreen
Toggles full screen mode for the current window. (But see:
<https://github.com/wez/wezterm/issues/177>)
```lua
return {
keys = {
{key="n", mods="SHIFT|CTRL", action="ToggleFullScreen"},
}
}
```
+6 -6
View File
@@ -17,10 +17,10 @@ return {
}
```
The parameter is a lua representation of the underlying
[KeyAssignment](https://github.com/wez/wezterm/blob/master/config/src/keyassignment.rs#L114)
enum from the configuration code. These docs aim to spell out sufficient
examples that you shouldn't need to learn to read Rust code, but there
are occasions where newly developed features are not yet documented and
an enterprising user may wish to go spelunking to figure them out!
The parameter is a lua representation of the underlying KeyAssignment enum from
the configuration code. These docs aim to spell out sufficient examples that
you shouldn't need to learn to read Rust code, but there are occasions where
newly developed features are not yet documented and an enterprising user may
wish to go spelunking to figure them out!
[You can find the reference for available KeyAssignment values here](../keyassignment/index.md).