mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 13:52:55 +03:00
docs: Use new wezterm.action.Action
syntax in rest of the docs
This commit is contained in:
parent
ee5206db50
commit
cf4d5de854
@ -18,7 +18,8 @@ having to remember so many key combinations, so what we'd like to do is use
|
|||||||
modes, using `r` for resize and `a` for activation:
|
modes, using `r` for resize and `a` for activation:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm';
|
local wezterm = require 'wezterm'
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
-- Show which key table is active in the status area
|
-- Show which key table is active in the status area
|
||||||
wezterm.on("update-right-status", function(window, pane)
|
wezterm.on("update-right-status", function(window, pane)
|
||||||
@ -27,28 +28,24 @@ wezterm.on("update-right-status", function(window, pane)
|
|||||||
name = "TABLE: " .. name
|
name = "TABLE: " .. name
|
||||||
end
|
end
|
||||||
window:set_right_status(name or "")
|
window:set_right_status(name or "")
|
||||||
end);
|
end)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
leader = {key="Space", mods="CTRL|SHIFT"},
|
leader = {key="Space", mods="CTRL|SHIFT"},
|
||||||
keys = {
|
keys = {
|
||||||
-- CTRL|SHIFT+Space, followed by 'r' will put us in resize-pane
|
-- CTRL+SHIFT+Space, followed by 'r' will put us in resize-pane
|
||||||
-- mode until we cancel that mode.
|
-- mode until we cancel that mode.
|
||||||
{key="r", mods="LEADER", action=wezterm.action{
|
{key="r", mods="LEADER", action=act.ActivateKeyTable{
|
||||||
ActivateKeyTable={
|
name="resize_pane",
|
||||||
name="resize_pane",
|
one_shot=false,
|
||||||
one_shot=false,
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
-- CTRL|SHIFT+Space, followed by 'a' will put us in activate-pane
|
-- CTRL+SHIFT+Space, followed by 'a' will put us in activate-pane
|
||||||
-- mode until we press some other key or until 1 second (1000ms)
|
-- mode until we press some other key or until 1 second (1000ms)
|
||||||
-- of time elapses
|
-- of time elapses
|
||||||
{key="a", mods="LEADER", action=wezterm.action{
|
{key="a", mods="LEADER", action=act.ActivateKeyTable{
|
||||||
ActivateKeyTable={
|
name="activate_pane",
|
||||||
name="activate_pane",
|
timeout_milliseconds=1000,
|
||||||
timeout_milliseconds=1000,
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -60,17 +57,17 @@ return {
|
|||||||
-- 'resize_pane' here corresponds to the name="resize_pane" in
|
-- 'resize_pane' here corresponds to the name="resize_pane" in
|
||||||
-- the key assignments above.
|
-- the key assignments above.
|
||||||
resize_pane = {
|
resize_pane = {
|
||||||
{key="LeftArrow", action=wezterm.action{AdjustPaneSize={"Left", 1}}},
|
{key="LeftArrow", action=act.AdjustPaneSize{"Left", 1}},
|
||||||
{key="h", action=wezterm.action{AdjustPaneSize={"Left", 1}}},
|
{key="h", action=act.AdjustPaneSize{"Left", 1}},
|
||||||
|
|
||||||
{key="RightArrow", action=wezterm.action{AdjustPaneSize={"Right", 1}}},
|
{key="RightArrow", action=act.AdjustPaneSize{"Right", 1}},
|
||||||
{key="l", action=wezterm.action{AdjustPaneSize={"Right", 1}}},
|
{key="l", action=act.AdjustPaneSize{"Right", 1}},
|
||||||
|
|
||||||
{key="UpArrow", action=wezterm.action{AdjustPaneSize={"Up", 1}}},
|
{key="UpArrow", action=act.AdjustPaneSize{"Up", 1}},
|
||||||
{key="k", action=wezterm.action{AdjustPaneSize={"Up", 1}}},
|
{key="k", action=act.AdjustPaneSize{"Up", 1}},
|
||||||
|
|
||||||
{key="DownArrow", action=wezterm.action{AdjustPaneSize={"Down", 1}}},
|
{key="DownArrow", action=act.AdjustPaneSize{"Down", 1}},
|
||||||
{key="j", action=wezterm.action{AdjustPaneSize={"Down", 1}}},
|
{key="j", action=act.AdjustPaneSize{"Down", 1}},
|
||||||
|
|
||||||
-- Cancel the mode by pressing escape
|
-- Cancel the mode by pressing escape
|
||||||
{key="Escape", action="PopKeyTable"},
|
{key="Escape", action="PopKeyTable"},
|
||||||
@ -81,17 +78,17 @@ return {
|
|||||||
-- 'activate_pane' here corresponds to the name="activate_pane" in
|
-- 'activate_pane' here corresponds to the name="activate_pane" in
|
||||||
-- the key assignments above.
|
-- the key assignments above.
|
||||||
activate_pane = {
|
activate_pane = {
|
||||||
{key="LeftArrow", action=wezterm.action{ActivatePaneDirection="Left"}},
|
{key="LeftArrow", action=act.ActivatePaneDirection("Left")},
|
||||||
{key="h", action=wezterm.action{ActivatePaneDirection="Left"}},
|
{key="h", action=act.ActivatePaneDirection("Left")},
|
||||||
|
|
||||||
{key="RightArrow", action=wezterm.action{ActivatePaneDirection="Right"}},
|
{key="RightArrow", action=act.ActivatePaneDirection("Right")},
|
||||||
{key="l", action=wezterm.action{ActivatePaneDirection="Right"}},
|
{key="l", action=act.ActivatePaneDirection("Right")},
|
||||||
|
|
||||||
{key="UpArrow", action=wezterm.action{ActivatePaneDirection="Up"}},
|
{key="UpArrow", action=act.ActivatePaneDirection("Up")},
|
||||||
{key="k", action=wezterm.action{ActivatePaneDirection="Up"}},
|
{key="k", action=act.ActivatePaneDirection("Up")},
|
||||||
|
|
||||||
{key="DownArrow", action=wezterm.action{ActivatePaneDirection="Down"}},
|
{key="DownArrow", action=act.ActivatePaneDirection("Down")},
|
||||||
{key="j", action=wezterm.action{ActivatePaneDirection="Down"}},
|
{key="j", action=act.ActivatePaneDirection("Down")},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -143,9 +143,9 @@ return {
|
|||||||
-- timeout_milliseconds defaults to 1000 and can be omitted
|
-- timeout_milliseconds defaults to 1000 and can be omitted
|
||||||
leader = { key="a", mods="CTRL", timeout_milliseconds=1000 },
|
leader = { key="a", mods="CTRL", timeout_milliseconds=1000 },
|
||||||
keys = {
|
keys = {
|
||||||
{key="|", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
|
{key="|", mods="LEADER|SHIFT", action=wezterm.action.SplitHorizontal{domain="CurrentPaneDomain"}},
|
||||||
-- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A
|
-- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A
|
||||||
{key="a", mods="LEADER|CTRL", action=wezterm.action{SendString="\x01"}},
|
{key="a", mods="LEADER|CTRL", action=wezterm.action.SendString("\x01")},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -168,8 +168,8 @@ return {
|
|||||||
-- for this example use `setxkbmap -option caps:none` in your terminal.
|
-- for this example use `setxkbmap -option caps:none` in your terminal.
|
||||||
leader = { key="VoidSymbol", mods="", timeout_milliseconds=1000 },
|
leader = { key="VoidSymbol", mods="", timeout_milliseconds=1000 },
|
||||||
keys = {
|
keys = {
|
||||||
{key="|", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
|
{key="|", mods="LEADER|SHIFT", action=wezterm.action.SplitHorizontal{domain="CurrentPaneDomain"}},
|
||||||
{key="-", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
|
{key="-", mods="LEADER", action=wezterm.action.SplitVertical{domain="CurrentPaneDomain"}},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -22,13 +22,15 @@ return {
|
|||||||
if has_selection then
|
if has_selection then
|
||||||
window:perform_action(
|
window:perform_action(
|
||||||
act.CopyTo("ClipboardAndPrimarySelection"),
|
act.CopyTo("ClipboardAndPrimarySelection"),
|
||||||
pane)
|
pane,
|
||||||
|
)
|
||||||
|
|
||||||
window:perform_action("ClearSelection", pane)
|
window:perform_action(act.ClearSelection, pane)
|
||||||
else
|
else
|
||||||
window:perform_action(
|
window:perform_action(
|
||||||
act.SendKey{key="c", mods="CTRL"}},
|
act.SendKey{key="c", mods="CTRL"},
|
||||||
pane)
|
pane,
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,14 @@
|
|||||||
|
|
||||||
Extends the current text selection to the current mouse cursor position.
|
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 mode argument can be one of `Cell`, `Word` or `Line` to control
|
||||||
the scope of the selection:
|
the scope of the selection.
|
||||||
|
|
||||||
|
*Since: 20220624-141144-bd1b7c5d*
|
||||||
|
|
||||||
|
The mode argument can also be `"Block"` to enable a rectangular block selection.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require "wezterm"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mouse_bindings = {
|
mouse_bindings = {
|
||||||
@ -21,13 +25,14 @@ return {
|
|||||||
It is also possible to leave the mode unspecified like this:
|
It is also possible to leave the mode unspecified like this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
local wezterm = require "wezterm"
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mouse_bindings = {
|
mouse_bindings = {
|
||||||
{
|
{
|
||||||
event={Up={streak=1, button="Left"}},
|
event={Up={streak=1, button="Left"}},
|
||||||
mods="SHIFT",
|
mods="SHIFT",
|
||||||
-- Note that there is no `wezterm.action` here
|
action=wezterm.action.ExtendSelectionToMouseCursor(nil),
|
||||||
action={ExtendSelectionToMouseCursor={}},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,7 +41,3 @@ return {
|
|||||||
when unspecified, wezterm will use a default mode which at the time
|
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
|
of writing is `Cell`, but in a future release may be context sensitive
|
||||||
based on recent actions.
|
based on recent actions.
|
||||||
|
|
||||||
*Since: 20220624-141144-bd1b7c5d*
|
|
||||||
|
|
||||||
The mode argument can also be `"Block"` to enable a rectangular block selection.
|
|
||||||
|
@ -11,5 +11,3 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,5 +11,3 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,5 +11,3 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ from the left, and so on.
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
local act = wezterm.action
|
|
||||||
|
|
||||||
local mykeys = {}
|
local mykeys = {}
|
||||||
for i = 1, 8 do
|
for i = 1, 8 do
|
||||||
@ -14,7 +13,7 @@ for i = 1, 8 do
|
|||||||
table.insert(mykeys, {
|
table.insert(mykeys, {
|
||||||
key=tostring(i),
|
key=tostring(i),
|
||||||
mods="CTRL|ALT",
|
mods="CTRL|ALT",
|
||||||
action=act.MoveTab(i-1),
|
action=wezterm.action.MoveTab(i - 1),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,6 +31,6 @@ return {
|
|||||||
|
|
||||||
*since: 20220624-141144-bd1b7c5d*
|
*since: 20220624-141144-bd1b7c5d*
|
||||||
|
|
||||||
You may now use `wezterm.action.Search="CurrentSelectionOrEmptyString"}` to have the search take the currently selected text as the item to search.
|
You may now use `wezterm.action.Search("CurrentSelectionOrEmptyString")` to have the search take the currently selected text as the item to search.
|
||||||
|
|
||||||
The selection text is adjusted to be a single line.
|
The selection text is adjusted to be a single line.
|
||||||
|
@ -10,7 +10,7 @@ local wezterm = require 'wezterm'
|
|||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
-- CMD-y starts `top` in a new window
|
-- CMD-y starts `top` in a new window
|
||||||
{key="y", mods="CMD", action=wezterm.actionSpawnCommandInNewTab{
|
{key="y", mods="CMD", action=wezterm.action.SpawnCommandInNewTab{
|
||||||
args={"top"}
|
args={"top"}
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ return {
|
|||||||
|
|
||||||
## Older versions
|
## Older versions
|
||||||
|
|
||||||
Usage looks like this:
|
For versions before *20220624-141144-bd1b7c5d*, usage looks like this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm';
|
local wezterm = require 'wezterm';
|
||||||
|
@ -12,7 +12,7 @@ The implementation is essentially the same as:
|
|||||||
function wezterm.action_callback(callback)
|
function wezterm.action_callback(callback)
|
||||||
local event_id = "..." -- the function generates a unique event id
|
local event_id = "..." -- the function generates a unique event id
|
||||||
wezterm.on(event_id, callback)
|
wezterm.on(event_id, callback)
|
||||||
return wezterm.action{EmitEvent=event_id}
|
return wezterm.action.EmitEvent(event_id)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@ For example, if you prefer to launch your preferred MUA in a new window
|
|||||||
in response to clicking on `mailto:` URLs, you could do something like:
|
in response to clicking on `mailto:` URLs, you could do something like:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm';
|
local wezterm = require "wezterm"
|
||||||
|
|
||||||
wezterm.on("open-uri", function(window, pane, uri)
|
wezterm.on("open-uri", function(window, pane, uri)
|
||||||
local start, match_end = uri:find("mailto:")
|
local start, match_end = uri:find("mailto:")
|
||||||
if start == 1 then
|
if start == 1 then
|
||||||
local recipient = uri:sub(match_end+1)
|
local recipient = uri:sub(match_end+1)
|
||||||
window:perform_action(wezterm.action{SpawnCommandInNewWindow={
|
window:perform_action(wezterm.action.SpawnCommandInNewWindow{
|
||||||
args={"mutt", recipient}
|
args={"mutt", recipient}
|
||||||
}}, pane);
|
}, pane)
|
||||||
-- prevent the default action from opening in a browser
|
-- prevent the default action from opening in a browser
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -16,7 +16,7 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
{key="9", mods="ALT", action=wezterm.action{ShowLauncherArgs={flags="FUZZY|WORKSPACES"}}},
|
{key="9", mods="ALT", action=wezterm.action.ShowLauncherArgs{flags="FUZZY|WORKSPACES"}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -23,7 +23,7 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
{key="E", mods="CTRL", action=wezterm.action{EmitEvent="show-font-size"}},
|
{key="E", mods="CTRL", action=wezterm.action.EmitEvent("show-font-size")},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -23,7 +23,7 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
{key="E", mods="CTRL", action=wezterm.action{EmitEvent="log-selection"}},
|
{key="E", mods="CTRL", action=wezterm.action.EmitEvent("log-selection")},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -12,5 +12,4 @@ The first parameter is a key assignment such as that returned by [`wezterm.actio
|
|||||||
|
|
||||||
The second parameter is a `pane` object passed to your event callback.
|
The second parameter is a `pane` object passed to your event callback.
|
||||||
|
|
||||||
For an example of this method in action, see [`wezterm.on Custom Events`](../wezterm/on.md#custom-events).
|
For an example of this method in action, see [`wezterm.on` Custom Events](../wezterm/on.md#custom-events).
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
{key="E", mods="CTRL", action=wezterm.action{EmitEvent="toggle-ligature"}},
|
{key="E", mods="CTRL", action=wezterm.action.EmitEvent("toggle-ligature")},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -60,7 +60,7 @@ end)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
{key="B", mods="CTRL", action=wezterm.action{EmitEvent="toggle-opacity"}},
|
{key="B", mods="CTRL", action=wezterm.action.EmitEvent("toggle-opacity")},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -26,27 +26,29 @@ of that triple click, so for a triple click both
|
|||||||
`SelectTextAtMouseCursor="Line"` and `CompleteSelection` will be triggered in
|
`SelectTextAtMouseCursor="Line"` and `CompleteSelection` will be triggered in
|
||||||
that order.
|
that order.
|
||||||
|
|
||||||
|
NOTE: In the action column, `act` is an alias to `wezterm.action` (to avoid repetition).
|
||||||
|
|
||||||
| Event | Modifiers | Action |
|
| Event | Modifiers | Action |
|
||||||
| --------- | --- | ------ |
|
| --------- | --- | ------ |
|
||||||
| Triple Left Down | `NONE` | `SelectTextAtMouseCursor="Line"` |
|
| Triple Left Down | `NONE` | `act.SelectTextAtMouseCursor("Line")` |
|
||||||
| Double Left Down | `NONE` | `SelectTextAtMouseCursor="Word"` |
|
| Double Left Down | `NONE` | `act.SelectTextAtMouseCursor("Word")` |
|
||||||
| Single Left Down | `NONE` | `SelectTextAtMouseCursor="Cell"` |
|
| Single Left Down | `NONE` | `act.SelectTextAtMouseCursor("Cell")` |
|
||||||
| Single Left Down | `SHIFT` | `ExtendSelectionToMouseCursor={}` |
|
| Single Left Down | `SHIFT` | `act.ExtendSelectionToMouseCursor("Cell")` |
|
||||||
| Single Left Down | `ALT` | `SelectTextAtMouseCursor="Block"` (*since: 20220624-141144-bd1b7c5d*) |
|
| Single Left Down | `ALT` | `act.SelectTextAtMouseCursor("Block")` (*since: 20220624-141144-bd1b7c5d*) |
|
||||||
| Single Left Up | `SHIFT` | `CompleteSelectionOrOpenLinkAtMouseCursor="PrimarySelection"` |
|
| Single Left Up | `SHIFT` | `act.CompleteSelectionOrOpenLinkAtMouseCursor("PrimarySelection")` |
|
||||||
| Single Left Up | `NONE` | `CompleteSelectionOrOpenLinkAtMouseCursor="PrimarySelection"` |
|
| Single Left Up | `NONE` | `act.CompleteSelectionOrOpenLinkAtMouseCursor("PrimarySelection")` |
|
||||||
| Single Left Up | `ALT` | `CompleteSelection="PrimarySelection"` (*since: 20220624-141144-bd1b7c5d*) |
|
| Single Left Up | `ALT` | `act.CompleteSelection("PrimarySelection")` (*since: 20220624-141144-bd1b7c5d*) |
|
||||||
| Double Left Up | `NONE` | `CompleteSelection="PrimarySelection"` |
|
| Double Left Up | `NONE` | `act.CompleteSelection("PrimarySelection")` |
|
||||||
| Triple Left Up | `NONE` | `CompleteSelection="PrimarySelection"` |
|
| Triple Left Up | `NONE` | `act.CompleteSelection("PrimarySelection")` |
|
||||||
| Single Left Drag | `NONE` | `ExtendSelectionToMouseCursor="Cell"` |
|
| Single Left Drag | `NONE` | `act.ExtendSelectionToMouseCursor("Cell")` |
|
||||||
| Single Left Drag | `ALT` | `ExtendSelectionToMouseCursor="Block"` (*since: 20220624-141144-bd1b7c5d*) |
|
| Single Left Drag | `ALT` | `act.ExtendSelectionToMouseCursor("Block")` (*since: 20220624-141144-bd1b7c5d*) |
|
||||||
| Single Left Down | `ALT+SHIFT` | `ExtendSelectionToMouseCursor="Block"` (*since: 20220624-141144-bd1b7c5d*) |
|
| Single Left Down | `ALT+SHIFT` | `act.ExtendSelectionToMouseCursor("Block")` (*since: 20220624-141144-bd1b7c5d*) |
|
||||||
| Single Left Up | `ALT+SHIFT` | `CompleteSelection="PrimarySelection"` (*since: 20220624-141144-bd1b7c5d*) |
|
| Single Left Up | `ALT+SHIFT` | `act.CompleteSelection("PrimarySelection")` (*since: 20220624-141144-bd1b7c5d*) |
|
||||||
| Double Left Drag | `NONE` | `ExtendSelectionToMouseCursor="Word"` |
|
| Double Left Drag | `NONE` | `act.ExtendSelectionToMouseCursor("Word")` |
|
||||||
| Triple Left Drag | `NONE` | `ExtendSelectionToMouseCursor="Line"` |
|
| Triple Left Drag | `NONE` | `act.ExtendSelectionToMouseCursor("Line")` |
|
||||||
| Single Middle Down | `NONE` | `PasteFrom="PrimarySelection"` |
|
| Single Middle Down | `NONE` | `act.PasteFrom("PrimarySelection")` |
|
||||||
| Single Left Drag | `SUPER` | `StartWindowDrag` (*since 20210314-114017-04b7cedd*) |
|
| Single Left Drag | `SUPER` | `act.StartWindowDrag` (*since 20210314-114017-04b7cedd*) |
|
||||||
| Single Left Drag | `CTRL+SHIFT` | `StartWindowDrag` (*since 20210314-114017-04b7cedd*) |
|
| Single Left Drag | `CTRL+SHIFT` | `act.StartWindowDrag` (*since 20210314-114017-04b7cedd*) |
|
||||||
|
|
||||||
If you don't want the default assignments to be registered, you can
|
If you don't want the default assignments to be registered, you can
|
||||||
disable all of them with this configuration; if you chose to do this,
|
disable all of them with this configuration; if you chose to do this,
|
||||||
@ -66,6 +68,7 @@ You can define mouse actions using the `mouse_bindings` configuration section:
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm';
|
local wezterm = require 'wezterm';
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mouse_bindings = {
|
mouse_bindings = {
|
||||||
@ -73,7 +76,7 @@ return {
|
|||||||
{
|
{
|
||||||
event={Down={streak=1, button="Right"}},
|
event={Down={streak=1, button="Right"}},
|
||||||
mods="NONE",
|
mods="NONE",
|
||||||
action=wezterm.action{SendString="woot"}
|
action=act.SendString("woot"),
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Change the default click behavior so that it only selects
|
-- Change the default click behavior so that it only selects
|
||||||
@ -81,14 +84,14 @@ return {
|
|||||||
{
|
{
|
||||||
event={Up={streak=1, button="Left"}},
|
event={Up={streak=1, button="Left"}},
|
||||||
mods="NONE",
|
mods="NONE",
|
||||||
action=wezterm.action{CompleteSelection="PrimarySelection"},
|
action=act.CompleteSelection("PrimarySelection"),
|
||||||
},
|
},
|
||||||
|
|
||||||
-- and make CTRL-Click open hyperlinks
|
-- and make CTRL-Click open hyperlinks
|
||||||
{
|
{
|
||||||
event={Up={streak=1, button="Left"}},
|
event={Up={streak=1, button="Left"}},
|
||||||
mods="CTRL",
|
mods="CTRL",
|
||||||
action="OpenLinkAtMouseCursor",
|
action=act.OpenLinkAtMouseCursor,
|
||||||
},
|
},
|
||||||
-- NOTE that binding only the 'Up' event can give unexpected behaviors.
|
-- NOTE that binding only the 'Up' event can give unexpected behaviors.
|
||||||
-- Read more below on the gotcha of binding an 'Up' event only.
|
-- Read more below on the gotcha of binding an 'Up' event only.
|
||||||
@ -133,19 +136,22 @@ event, but not the 'Up' event (which is bound to something in your config).
|
|||||||
To avoid this, it is recommended to disable the 'Down' event (to ensure it won't
|
To avoid this, it is recommended to disable the 'Down' event (to ensure it won't
|
||||||
be sent to the running program), for example:
|
be sent to the running program), for example:
|
||||||
```lua
|
```lua
|
||||||
|
local wezterm = require "wezterm"
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mouse_bindings = {
|
mouse_bindings = {
|
||||||
-- Bind 'Up' event of CTRL-Click to open hyperlinks
|
-- Bind 'Up' event of CTRL-Click to open hyperlinks
|
||||||
{
|
{
|
||||||
event={Up={streak=1, button="Left"}},
|
event={Up={streak=1, button="Left"}},
|
||||||
mods="CTRL",
|
mods="CTRL",
|
||||||
action="OpenLinkAtMouseCursor",
|
action=act.OpenLinkAtMouseCursor,
|
||||||
},
|
},
|
||||||
-- Disable the 'Down' event of CTRL-Click to avoid weird program behaviors
|
-- Disable the 'Down' event of CTRL-Click to avoid weird program behaviors
|
||||||
{
|
{
|
||||||
event={Down={streak=1, button="Left"}},
|
event={Down={streak=1, button="Left"}},
|
||||||
mods="CTRL",
|
mods="CTRL",
|
||||||
action="Nop",
|
action=act.Nop,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -156,5 +162,3 @@ return {
|
|||||||
|
|
||||||
See the [`KeyAssignment` reference](lua/keyassignment/index.md) for information
|
See the [`KeyAssignment` reference](lua/keyassignment/index.md) for information
|
||||||
on available actions.
|
on available actions.
|
||||||
|
|
||||||
|
|
||||||
|
100
docs/copymode.md
100
docs/copymode.md
@ -81,72 +81,72 @@ The default configuration is equivalent to:
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
return {
|
return {
|
||||||
key_tables = {
|
key_tables = {
|
||||||
copy_mode = {
|
copy_mode = {
|
||||||
{key="c", mods="CTRL", action=wezterm.action{CopyMode="Close"}},
|
{key="c", mods="CTRL", action=act.CopyMode("Close")},
|
||||||
{key="g", mods="CTRL", action=wezterm.action{CopyMode="Close"}},
|
{key="g", mods="CTRL", action=act.CopyMode("Close")},
|
||||||
{key="q", mods="NONE", action=wezterm.action{CopyMode="Close"}},
|
{key="q", mods="NONE", action=act.CopyMode("Close")},
|
||||||
{key="Escape", mods="NONE", action=wezterm.action{CopyMode="Close"}},
|
{key="Escape", mods="NONE", action=act.CopyMode("Close")},
|
||||||
|
|
||||||
{key="h", mods="NONE", action=wezterm.action{CopyMode="MoveLeft"}},
|
{key="h", mods="NONE", action=act.CopyMode("MoveLeft")},
|
||||||
{key="j", mods="NONE", action=wezterm.action{CopyMode="MoveDown"}},
|
{key="j", mods="NONE", action=act.CopyMode("MoveDown")},
|
||||||
{key="k", mods="NONE", action=wezterm.action{CopyMode="MoveUp"}},
|
{key="k", mods="NONE", action=act.CopyMode("MoveUp")},
|
||||||
{key="l", mods="NONE", action=wezterm.action{CopyMode="MoveRight"}},
|
{key="l", mods="NONE", action=act.CopyMode("MoveRight")},
|
||||||
|
|
||||||
{key="LeftArrow", mods="NONE", action=wezterm.action{CopyMode="MoveLeft"}},
|
{key="LeftArrow", mods="NONE", action=act.CopyMode("MoveLeft")},
|
||||||
{key="DownArrow", mods="NONE", action=wezterm.action{CopyMode="MoveDown"}},
|
{key="DownArrow", mods="NONE", action=act.CopyMode("MoveDown")},
|
||||||
{key="UpArrow", mods="NONE", action=wezterm.action{CopyMode="MoveUp"}},
|
{key="UpArrow", mods="NONE", action=act.CopyMode("MoveUp")},
|
||||||
{key="RightArrow", mods="NONE", action=wezterm.action{CopyMode="MoveRight"}},
|
{key="RightArrow", mods="NONE", action=act.CopyMode("MoveRight")},
|
||||||
|
|
||||||
{key="RightArrow", mods="ALT", action=wezterm.action{CopyMode="MoveForwardWord"}},
|
{key="RightArrow", mods="ALT", action=act.CopyMode("MoveForwardWord")},
|
||||||
{key="f", mods="ALT", action=wezterm.action{CopyMode="MoveForwardWord"}},
|
{key="f", mods="ALT", action=act.CopyMode("MoveForwardWord")},
|
||||||
{key="Tab", mods="NONE", action=wezterm.action{CopyMode="MoveForwardWord"}},
|
{key="Tab", mods="NONE", action=act.CopyMode("MoveForwardWord")},
|
||||||
{key="w", mods="NONE", action=wezterm.action{CopyMode="MoveForwardWord"}},
|
{key="w", mods="NONE", action=act.CopyMode("MoveForwardWord")},
|
||||||
|
|
||||||
{key="LeftArrow", mods="ALT", action=wezterm.action{CopyMode="MoveBackwardWord"}},
|
{key="LeftArrow", mods="ALT", action=act.CopyMode("MoveBackwardWord")},
|
||||||
{key="b", mods="ALT", action=wezterm.action{CopyMode="MoveBackwardWord"}},
|
{key="b", mods="ALT", action=act.CopyMode("MoveBackwardWord")},
|
||||||
{key="Tab", mods="SHIFT", action=wezterm.action{CopyMode="MoveBackwardWord"}},
|
{key="Tab", mods="SHIFT", action=act.CopyMode("MoveBackwardWord")},
|
||||||
{key="b", mods="NONE", action=wezterm.action{CopyMode="MoveBackwardWord"}},
|
{key="b", mods="NONE", action=act.CopyMode("MoveBackwardWord")},
|
||||||
|
|
||||||
{key="0", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfLine"}},
|
{key="0", mods="NONE", action=act.CopyMode("MoveToStartOfLine")},
|
||||||
{key="Enter", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfNextLine"}},
|
{key="Enter", mods="NONE", action=act.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=act.CopyMode("MoveToEndOfLineContent")},
|
||||||
{key="^", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}},
|
{key="$", mods="SHIFT", action=act.CopyMode("MoveToEndOfLineContent")},
|
||||||
{key="^", mods="SHIFT", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}},
|
{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=wezterm.action{CopyMode={SetSelectionMode="Cell"}}},
|
{key=" ", mods="NONE", action=act.CopyMode{SetSelectionMode="Cell"}},
|
||||||
{key="v", mods="NONE", action=wezterm.action{CopyMode={SetSelectionMode="Cell"}}},
|
{key="v", mods="NONE", action=act.CopyMode{SetSelectionMode="Cell"}},
|
||||||
{key="V", mods="NONE", action=wezterm.action{CopyMode={SetSelectionMode="Line"}}},
|
{key="V", mods="NONE", action=act.CopyMode{SetSelectionMode="Line"}},
|
||||||
{key="V", mods="SHIFT", action=wezterm.action{CopyMode={SetSelectionMode="Line"}}},
|
{key="V", mods="SHIFT", action=act.CopyMode{SetSelectionMode="Line"}},
|
||||||
{key="v", mods="CTRL", action=wezterm.action{CopyMode={SetSelectionMode="Block"}}},
|
{key="v", mods="CTRL", action=act.CopyMode{SetSelectionMode="Block"}},
|
||||||
|
|
||||||
{key="G", mods="NONE", action=wezterm.action{CopyMode="MoveToScrollbackBottom"}},
|
{key="G", mods="NONE", action=act.CopyMode("MoveToScrollbackBottom")},
|
||||||
{key="G", mods="SHIFT", action=wezterm.action{CopyMode="MoveToScrollbackBottom"}},
|
{key="G", mods="SHIFT", action=act.CopyMode("MoveToScrollbackBottom")},
|
||||||
{key="g", mods="NONE", action=wezterm.action{CopyMode="MoveToScrollbackTop"}},
|
{key="g", mods="NONE", action=act.CopyMode("MoveToScrollbackTop")},
|
||||||
|
|
||||||
{key="H", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportTop"}},
|
{key="H", mods="NONE", action=act.CopyMode("MoveToViewportTop")},
|
||||||
{key="H", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportTop"}},
|
{key="H", mods="SHIFT", action=act.CopyMode("MoveToViewportTop")},
|
||||||
{key="M", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportMiddle"}},
|
{key="M", mods="NONE", action=act.CopyMode("MoveToViewportMiddle")},
|
||||||
{key="M", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportMiddle"}},
|
{key="M", mods="SHIFT", action=act.CopyMode("MoveToViewportMiddle")},
|
||||||
{key="L", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportBottom"}},
|
{key="L", mods="NONE", action=act.CopyMode("MoveToViewportBottom")},
|
||||||
{key="L", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportBottom"}},
|
{key="L", mods="SHIFT", action=act.CopyMode("MoveToViewportBottom")},
|
||||||
|
|
||||||
{key="o", mods="NONE", action=wezterm.action{CopyMode="MoveToSelectionOtherEnd"}},
|
{key="o", mods="NONE", action=act.CopyMode("MoveToSelectionOtherEnd")},
|
||||||
{key="O", mods="NONE", action=wezterm.action{CopyMode="MoveToSelectionOtherEndHoriz"}},
|
{key="O", mods="NONE", action=act.CopyMode("MoveToSelectionOtherEndHoriz")},
|
||||||
{key="O", mods="SHIFT", action=wezterm.action{CopyMode="MoveToSelectionOtherEndHoriz"}},
|
{key="O", mods="SHIFT", action=act.CopyMode("MoveToSelectionOtherEndHoriz")},
|
||||||
|
|
||||||
{key="PageUp", mods="NONE", action=wezterm.action{CopyMode="PageUp"}},
|
{key="PageUp", mods="NONE", action=act.CopyMode("PageUp")},
|
||||||
{key="PageDown", mods="NONE", action=wezterm.action{CopyMode="PageDown"}},
|
{key="PageDown", mods="NONE", action=act.CopyMode("PageDown")},
|
||||||
|
|
||||||
{key="b", mods="CTRL", action=wezterm.action{CopyMode="PageUp"}},
|
{key="b", mods="CTRL", action=act.CopyMode("PageUp")},
|
||||||
{key="f", mods="CTRL", action=wezterm.action{CopyMode="PageDown"}},
|
{key="f", mods="CTRL", action=act.CopyMode("PageDown")},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -98,20 +98,21 @@ The default configuration is equivalent to:
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
return {
|
return {
|
||||||
key_tables = {
|
key_tables = {
|
||||||
search_mode = {
|
search_mode = {
|
||||||
{key="Escape", mods="NONE", action=wezterm.action{CopyMode="Close"}},
|
{key="Escape", mods="NONE", action=act.CopyMode("Close")},
|
||||||
{key="UpArrow", mods="NONE", action=wezterm.action{CopyMode="PriorMatch"}},
|
{key="UpArrow", mods="NONE", action=act.CopyMode("PriorMatch")},
|
||||||
{key="Enter", mods="NONE", action=wezterm.action{CopyMode="PriorMatch"}},
|
{key="Enter", mods="NONE", action=act.CopyMode("PriorMatch")},
|
||||||
{key="p", mods="CTRL", action=wezterm.action{CopyMode="PriorMatch"}},
|
{key="p", mods="CTRL", action=act.CopyMode("PriorMatch")},
|
||||||
{key="PageUp", mods="NONE", action=wezterm.action{CopyMode="PriorMatchPage"}},
|
{key="PageUp", mods="NONE", action=act.CopyMode("PriorMatchPage")},
|
||||||
{key="PageDown", mods="NONE", action=wezterm.action{CopyMode="NextMatchPage"}},
|
{key="PageDown", mods="NONE", action=act.CopyMode("NextMatchPage")},
|
||||||
{key="n", mods="CTRL", action=wezterm.action{CopyMode="NextMatchPage"}},
|
{key="n", mods="CTRL", action=act.CopyMode("NextMatchPage")},
|
||||||
{key="DownArrow", mods="NONE", action=wezterm.action{CopyMode="NextMatch"}},
|
{key="DownArrow", mods="NONE", action=act.CopyMode("NextMatch")},
|
||||||
{key="r", mods="CTRL", action=wezterm.action{CopyMode="CycleMatchType"}},
|
{key="r", mods="CTRL", action=act.CopyMode("CycleMatchType")},
|
||||||
{key="u", mods="CTRL", action=wezterm.action{CopyMode="ClearPattern"}},
|
{key="u", mods="CTRL", action=act.CopyMode("ClearPattern")},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +136,7 @@ local wezterm = require 'wezterm';
|
|||||||
return {
|
return {
|
||||||
keys = {
|
keys = {
|
||||||
-- search for things that look like git hashes
|
-- search for things that look like git hashes
|
||||||
{key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={Regex="[a-f0-9]{6,}"}}},
|
{key="H", mods="SHIFT|CTRL", action=wezterm.action.Search{Regex="[a-f0-9]{6,}"}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user