From cf4d5de854f71231519c4f7b6573468953344293 Mon Sep 17 00:00:00 2001 From: Benoit de Chezelles Date: Sat, 25 Jun 2022 19:59:17 +0200 Subject: [PATCH] docs: Use new `wezterm.action.Action` syntax in rest of the docs --- docs/config/key-tables.md | 57 +++++----- docs/config/keys.md | 8 +- .../lua/keyassignment/ClearSelection.md | 10 +- .../ExtendSelectionToMouseCursor.md | 17 +-- docs/config/lua/keyassignment/Hide.md | 2 - .../lua/keyassignment/HideApplication.md | 2 - .../lua/keyassignment/IncreaseFontSize.md | 2 - docs/config/lua/keyassignment/MoveTab.md | 3 +- docs/config/lua/keyassignment/Search.md | 2 +- .../lua/keyassignment/SpawnCommandInNewTab.md | 2 +- docs/config/lua/wezterm/action.md | 2 +- docs/config/lua/wezterm/action_callback.md | 2 +- docs/config/lua/window-events/open-uri.md | 8 +- docs/config/lua/window/active_workspace.md | 2 +- docs/config/lua/window/effective_config.md | 2 +- .../lua/window/get_selection_text_for_pane.md | 2 +- docs/config/lua/window/perform_action.md | 3 +- .../config/lua/window/set_config_overrides.md | 4 +- docs/config/mouse.md | 56 +++++----- docs/copymode.md | 100 +++++++++--------- docs/scrollback.md | 23 ++-- 21 files changed, 153 insertions(+), 156 deletions(-) diff --git a/docs/config/key-tables.md b/docs/config/key-tables.md index 65bc1afc2..47f8c9bb3 100644 --- a/docs/config/key-tables.md +++ b/docs/config/key-tables.md @@ -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: ```lua -local wezterm = require 'wezterm'; +local wezterm = require 'wezterm' +local act = wezterm.action -- Show which key table is active in the status area wezterm.on("update-right-status", function(window, pane) @@ -27,28 +28,24 @@ wezterm.on("update-right-status", function(window, pane) name = "TABLE: " .. name end window:set_right_status(name or "") -end); +end) return { leader = {key="Space", mods="CTRL|SHIFT"}, 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. - {key="r", mods="LEADER", action=wezterm.action{ - ActivateKeyTable={ - name="resize_pane", - one_shot=false, - } + {key="r", mods="LEADER", action=act.ActivateKeyTable{ + name="resize_pane", + 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) -- of time elapses - {key="a", mods="LEADER", action=wezterm.action{ - ActivateKeyTable={ - name="activate_pane", - timeout_milliseconds=1000, - } + {key="a", mods="LEADER", action=act.ActivateKeyTable{ + name="activate_pane", + timeout_milliseconds=1000, }}, }, @@ -60,17 +57,17 @@ return { -- 'resize_pane' here corresponds to the name="resize_pane" in -- the key assignments above. resize_pane = { - {key="LeftArrow", action=wezterm.action{AdjustPaneSize={"Left", 1}}}, - {key="h", action=wezterm.action{AdjustPaneSize={"Left", 1}}}, + {key="LeftArrow", action=act.AdjustPaneSize{"Left", 1}}, + {key="h", action=act.AdjustPaneSize{"Left", 1}}, - {key="RightArrow", action=wezterm.action{AdjustPaneSize={"Right", 1}}}, - {key="l", action=wezterm.action{AdjustPaneSize={"Right", 1}}}, + {key="RightArrow", action=act.AdjustPaneSize{"Right", 1}}, + {key="l", action=act.AdjustPaneSize{"Right", 1}}, - {key="UpArrow", action=wezterm.action{AdjustPaneSize={"Up", 1}}}, - {key="k", action=wezterm.action{AdjustPaneSize={"Up", 1}}}, + {key="UpArrow", action=act.AdjustPaneSize{"Up", 1}}, + {key="k", action=act.AdjustPaneSize{"Up", 1}}, - {key="DownArrow", action=wezterm.action{AdjustPaneSize={"Down", 1}}}, - {key="j", action=wezterm.action{AdjustPaneSize={"Down", 1}}}, + {key="DownArrow", action=act.AdjustPaneSize{"Down", 1}}, + {key="j", action=act.AdjustPaneSize{"Down", 1}}, -- Cancel the mode by pressing escape {key="Escape", action="PopKeyTable"}, @@ -81,17 +78,17 @@ return { -- 'activate_pane' here corresponds to the name="activate_pane" in -- the key assignments above. activate_pane = { - {key="LeftArrow", action=wezterm.action{ActivatePaneDirection="Left"}}, - {key="h", action=wezterm.action{ActivatePaneDirection="Left"}}, + {key="LeftArrow", action=act.ActivatePaneDirection("Left")}, + {key="h", action=act.ActivatePaneDirection("Left")}, - {key="RightArrow", action=wezterm.action{ActivatePaneDirection="Right"}}, - {key="l", action=wezterm.action{ActivatePaneDirection="Right"}}, + {key="RightArrow", action=act.ActivatePaneDirection("Right")}, + {key="l", action=act.ActivatePaneDirection("Right")}, - {key="UpArrow", action=wezterm.action{ActivatePaneDirection="Up"}}, - {key="k", action=wezterm.action{ActivatePaneDirection="Up"}}, + {key="UpArrow", action=act.ActivatePaneDirection("Up")}, + {key="k", action=act.ActivatePaneDirection("Up")}, - {key="DownArrow", action=wezterm.action{ActivatePaneDirection="Down"}}, - {key="j", action=wezterm.action{ActivatePaneDirection="Down"}}, + {key="DownArrow", action=act.ActivatePaneDirection("Down")}, + {key="j", action=act.ActivatePaneDirection("Down")}, }, }, diff --git a/docs/config/keys.md b/docs/config/keys.md index 282a23004..9e0ea4d2d 100644 --- a/docs/config/keys.md +++ b/docs/config/keys.md @@ -143,9 +143,9 @@ return { -- timeout_milliseconds defaults to 1000 and can be omitted leader = { key="a", mods="CTRL", timeout_milliseconds=1000 }, 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 - {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. leader = { key="VoidSymbol", mods="", timeout_milliseconds=1000 }, keys = { - {key="|", mods="LEADER|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}}, - {key="-", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}}, + {key="|", mods="LEADER|SHIFT", action=wezterm.action.SplitHorizontal{domain="CurrentPaneDomain"}}, + {key="-", mods="LEADER", action=wezterm.action.SplitVertical{domain="CurrentPaneDomain"}}, } } ``` diff --git a/docs/config/lua/keyassignment/ClearSelection.md b/docs/config/lua/keyassignment/ClearSelection.md index 84c244853..f58d7b9fa 100644 --- a/docs/config/lua/keyassignment/ClearSelection.md +++ b/docs/config/lua/keyassignment/ClearSelection.md @@ -22,13 +22,15 @@ return { if has_selection then window:perform_action( act.CopyTo("ClipboardAndPrimarySelection"), - pane) + pane, + ) - window:perform_action("ClearSelection", pane) + window:perform_action(act.ClearSelection, pane) else window:perform_action( - act.SendKey{key="c", mods="CTRL"}}, - pane) + act.SendKey{key="c", mods="CTRL"}, + pane, + ) end end) } diff --git a/docs/config/lua/keyassignment/ExtendSelectionToMouseCursor.md b/docs/config/lua/keyassignment/ExtendSelectionToMouseCursor.md index a0c51addf..6919e9298 100644 --- a/docs/config/lua/keyassignment/ExtendSelectionToMouseCursor.md +++ b/docs/config/lua/keyassignment/ExtendSelectionToMouseCursor.md @@ -2,10 +2,14 @@ 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: +the scope of the selection. + +*Since: 20220624-141144-bd1b7c5d* + +The mode argument can also be `"Block"` to enable a rectangular block selection. ```lua -local wezterm = require 'wezterm' +local wezterm = require "wezterm" return { mouse_bindings = { @@ -21,13 +25,14 @@ return { It is also possible to leave the mode unspecified like this: ```lua +local wezterm = require "wezterm" + return { mouse_bindings = { { event={Up={streak=1, button="Left"}}, mods="SHIFT", - -- Note that there is no `wezterm.action` here - action={ExtendSelectionToMouseCursor={}}, + action=wezterm.action.ExtendSelectionToMouseCursor(nil), }, } } @@ -36,7 +41,3 @@ return { 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. - -*Since: 20220624-141144-bd1b7c5d* - -The mode argument can also be `"Block"` to enable a rectangular block selection. diff --git a/docs/config/lua/keyassignment/Hide.md b/docs/config/lua/keyassignment/Hide.md index 45527d6d8..9db570e0c 100644 --- a/docs/config/lua/keyassignment/Hide.md +++ b/docs/config/lua/keyassignment/Hide.md @@ -11,5 +11,3 @@ return { } } ``` - - diff --git a/docs/config/lua/keyassignment/HideApplication.md b/docs/config/lua/keyassignment/HideApplication.md index ec9609d4c..4a934878c 100644 --- a/docs/config/lua/keyassignment/HideApplication.md +++ b/docs/config/lua/keyassignment/HideApplication.md @@ -11,5 +11,3 @@ return { } } ``` - - diff --git a/docs/config/lua/keyassignment/IncreaseFontSize.md b/docs/config/lua/keyassignment/IncreaseFontSize.md index 829a4ba69..288b6ab07 100644 --- a/docs/config/lua/keyassignment/IncreaseFontSize.md +++ b/docs/config/lua/keyassignment/IncreaseFontSize.md @@ -11,5 +11,3 @@ return { } } ``` - - diff --git a/docs/config/lua/keyassignment/MoveTab.md b/docs/config/lua/keyassignment/MoveTab.md index 7ecb8bbfa..69e9debd7 100644 --- a/docs/config/lua/keyassignment/MoveTab.md +++ b/docs/config/lua/keyassignment/MoveTab.md @@ -6,7 +6,6 @@ from the left, and so on. ```lua local wezterm = require 'wezterm' -local act = wezterm.action local mykeys = {} for i = 1, 8 do @@ -14,7 +13,7 @@ for i = 1, 8 do table.insert(mykeys, { key=tostring(i), mods="CTRL|ALT", - action=act.MoveTab(i-1), + action=wezterm.action.MoveTab(i - 1), }) end diff --git a/docs/config/lua/keyassignment/Search.md b/docs/config/lua/keyassignment/Search.md index 8a64b6a6d..e603aad1f 100644 --- a/docs/config/lua/keyassignment/Search.md +++ b/docs/config/lua/keyassignment/Search.md @@ -31,6 +31,6 @@ return { *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. diff --git a/docs/config/lua/keyassignment/SpawnCommandInNewTab.md b/docs/config/lua/keyassignment/SpawnCommandInNewTab.md index 41941740b..1878b47cc 100644 --- a/docs/config/lua/keyassignment/SpawnCommandInNewTab.md +++ b/docs/config/lua/keyassignment/SpawnCommandInNewTab.md @@ -10,7 +10,7 @@ local wezterm = require 'wezterm' return { keys = { -- 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"} }}, } diff --git a/docs/config/lua/wezterm/action.md b/docs/config/lua/wezterm/action.md index ace5d408c..4692833e7 100644 --- a/docs/config/lua/wezterm/action.md +++ b/docs/config/lua/wezterm/action.md @@ -84,7 +84,7 @@ return { ## Older versions -Usage looks like this: +For versions before *20220624-141144-bd1b7c5d*, usage looks like this: ```lua local wezterm = require 'wezterm'; diff --git a/docs/config/lua/wezterm/action_callback.md b/docs/config/lua/wezterm/action_callback.md index cac91918c..4e1ef1310 100644 --- a/docs/config/lua/wezterm/action_callback.md +++ b/docs/config/lua/wezterm/action_callback.md @@ -12,7 +12,7 @@ The implementation is essentially the same as: function wezterm.action_callback(callback) local event_id = "..." -- the function generates a unique event id wezterm.on(event_id, callback) - return wezterm.action{EmitEvent=event_id} + return wezterm.action.EmitEvent(event_id) end ``` diff --git a/docs/config/lua/window-events/open-uri.md b/docs/config/lua/window-events/open-uri.md index 6577f1586..908acf079 100644 --- a/docs/config/lua/window-events/open-uri.md +++ b/docs/config/lua/window-events/open-uri.md @@ -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: ```lua -local wezterm = require 'wezterm'; +local wezterm = require "wezterm" wezterm.on("open-uri", function(window, pane, uri) local start, match_end = uri:find("mailto:") if start == 1 then local recipient = uri:sub(match_end+1) - window:perform_action(wezterm.action{SpawnCommandInNewWindow={ - args={"mutt", recipient} - }}, pane); + window:perform_action(wezterm.action.SpawnCommandInNewWindow{ + args={"mutt", recipient} + }, pane) -- prevent the default action from opening in a browser return false end diff --git a/docs/config/lua/window/active_workspace.md b/docs/config/lua/window/active_workspace.md index f2608bb3a..d902dd45f 100644 --- a/docs/config/lua/window/active_workspace.md +++ b/docs/config/lua/window/active_workspace.md @@ -16,7 +16,7 @@ end) return { keys = { - {key="9", mods="ALT", action=wezterm.action{ShowLauncherArgs={flags="FUZZY|WORKSPACES"}}}, + {key="9", mods="ALT", action=wezterm.action.ShowLauncherArgs{flags="FUZZY|WORKSPACES"}}, }, } ``` diff --git a/docs/config/lua/window/effective_config.md b/docs/config/lua/window/effective_config.md index 0916b602c..bbc62f51f 100644 --- a/docs/config/lua/window/effective_config.md +++ b/docs/config/lua/window/effective_config.md @@ -23,7 +23,7 @@ end) return { keys = { - {key="E", mods="CTRL", action=wezterm.action{EmitEvent="show-font-size"}}, + {key="E", mods="CTRL", action=wezterm.action.EmitEvent("show-font-size")}, }, } ``` diff --git a/docs/config/lua/window/get_selection_text_for_pane.md b/docs/config/lua/window/get_selection_text_for_pane.md index 59b9f1b30..daeefb6ba 100644 --- a/docs/config/lua/window/get_selection_text_for_pane.md +++ b/docs/config/lua/window/get_selection_text_for_pane.md @@ -23,7 +23,7 @@ end) return { keys = { - {key="E", mods="CTRL", action=wezterm.action{EmitEvent="log-selection"}}, + {key="E", mods="CTRL", action=wezterm.action.EmitEvent("log-selection")}, } } ``` diff --git a/docs/config/lua/window/perform_action.md b/docs/config/lua/window/perform_action.md index a6b9eaee4..e09964a5c 100644 --- a/docs/config/lua/window/perform_action.md +++ b/docs/config/lua/window/perform_action.md @@ -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. -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). diff --git a/docs/config/lua/window/set_config_overrides.md b/docs/config/lua/window/set_config_overrides.md index 8786e8a3e..22d49c771 100644 --- a/docs/config/lua/window/set_config_overrides.md +++ b/docs/config/lua/window/set_config_overrides.md @@ -37,7 +37,7 @@ end) return { 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 { keys = { - {key="B", mods="CTRL", action=wezterm.action{EmitEvent="toggle-opacity"}}, + {key="B", mods="CTRL", action=wezterm.action.EmitEvent("toggle-opacity")}, }, } ``` diff --git a/docs/config/mouse.md b/docs/config/mouse.md index 23579bd53..16f0fa4c8 100644 --- a/docs/config/mouse.md +++ b/docs/config/mouse.md @@ -26,27 +26,29 @@ of that triple click, so for a triple click both `SelectTextAtMouseCursor="Line"` and `CompleteSelection` will be triggered in that order. +NOTE: In the action column, `act` is an alias to `wezterm.action` (to avoid repetition). + | Event | Modifiers | Action | | --------- | --- | ------ | -| Triple Left Down | `NONE` | `SelectTextAtMouseCursor="Line"` | -| Double Left Down | `NONE` | `SelectTextAtMouseCursor="Word"` | -| Single Left Down | `NONE` | `SelectTextAtMouseCursor="Cell"` | -| Single Left Down | `SHIFT` | `ExtendSelectionToMouseCursor={}` | -| Single Left Down | `ALT` | `SelectTextAtMouseCursor="Block"` (*since: 20220624-141144-bd1b7c5d*) | -| Single Left Up | `SHIFT` | `CompleteSelectionOrOpenLinkAtMouseCursor="PrimarySelection"` | -| Single Left Up | `NONE` | `CompleteSelectionOrOpenLinkAtMouseCursor="PrimarySelection"` | -| Single Left Up | `ALT` | `CompleteSelection="PrimarySelection"` (*since: 20220624-141144-bd1b7c5d*) | -| Double Left Up | `NONE` | `CompleteSelection="PrimarySelection"` | -| Triple Left Up | `NONE` | `CompleteSelection="PrimarySelection"` | -| Single Left Drag | `NONE` | `ExtendSelectionToMouseCursor="Cell"` | -| Single Left Drag | `ALT` | `ExtendSelectionToMouseCursor="Block"` (*since: 20220624-141144-bd1b7c5d*) | -| Single Left Down | `ALT+SHIFT` | `ExtendSelectionToMouseCursor="Block"` (*since: 20220624-141144-bd1b7c5d*) | -| Single Left Up | `ALT+SHIFT` | `CompleteSelection="PrimarySelection"` (*since: 20220624-141144-bd1b7c5d*) | -| Double Left Drag | `NONE` | `ExtendSelectionToMouseCursor="Word"` | -| Triple Left Drag | `NONE` | `ExtendSelectionToMouseCursor="Line"` | -| Single Middle Down | `NONE` | `PasteFrom="PrimarySelection"` | -| Single Left Drag | `SUPER` | `StartWindowDrag` (*since 20210314-114017-04b7cedd*) | -| Single Left Drag | `CTRL+SHIFT` | `StartWindowDrag` (*since 20210314-114017-04b7cedd*) | +| Triple Left Down | `NONE` | `act.SelectTextAtMouseCursor("Line")` | +| Double Left Down | `NONE` | `act.SelectTextAtMouseCursor("Word")` | +| Single Left Down | `NONE` | `act.SelectTextAtMouseCursor("Cell")` | +| Single Left Down | `SHIFT` | `act.ExtendSelectionToMouseCursor("Cell")` | +| Single Left Down | `ALT` | `act.SelectTextAtMouseCursor("Block")` (*since: 20220624-141144-bd1b7c5d*) | +| Single Left Up | `SHIFT` | `act.CompleteSelectionOrOpenLinkAtMouseCursor("PrimarySelection")` | +| Single Left Up | `NONE` | `act.CompleteSelectionOrOpenLinkAtMouseCursor("PrimarySelection")` | +| Single Left Up | `ALT` | `act.CompleteSelection("PrimarySelection")` (*since: 20220624-141144-bd1b7c5d*) | +| Double Left Up | `NONE` | `act.CompleteSelection("PrimarySelection")` | +| Triple Left Up | `NONE` | `act.CompleteSelection("PrimarySelection")` | +| Single Left Drag | `NONE` | `act.ExtendSelectionToMouseCursor("Cell")` | +| Single Left Drag | `ALT` | `act.ExtendSelectionToMouseCursor("Block")` (*since: 20220624-141144-bd1b7c5d*) | +| Single Left Down | `ALT+SHIFT` | `act.ExtendSelectionToMouseCursor("Block")` (*since: 20220624-141144-bd1b7c5d*) | +| Single Left Up | `ALT+SHIFT` | `act.CompleteSelection("PrimarySelection")` (*since: 20220624-141144-bd1b7c5d*) | +| Double Left Drag | `NONE` | `act.ExtendSelectionToMouseCursor("Word")` | +| Triple Left Drag | `NONE` | `act.ExtendSelectionToMouseCursor("Line")` | +| Single Middle Down | `NONE` | `act.PasteFrom("PrimarySelection")` | +| Single Left Drag | `SUPER` | `act.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 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 local wezterm = require 'wezterm'; +local act = wezterm.action return { mouse_bindings = { @@ -73,7 +76,7 @@ return { { event={Down={streak=1, button="Right"}}, mods="NONE", - action=wezterm.action{SendString="woot"} + action=act.SendString("woot"), }, -- Change the default click behavior so that it only selects @@ -81,14 +84,14 @@ return { { event={Up={streak=1, button="Left"}}, mods="NONE", - action=wezterm.action{CompleteSelection="PrimarySelection"}, + action=act.CompleteSelection("PrimarySelection"), }, -- and make CTRL-Click open hyperlinks { event={Up={streak=1, button="Left"}}, mods="CTRL", - action="OpenLinkAtMouseCursor", + action=act.OpenLinkAtMouseCursor, }, -- NOTE that binding only the 'Up' event can give unexpected behaviors. -- 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 be sent to the running program), for example: ```lua +local wezterm = require "wezterm" +local act = wezterm.action + return { mouse_bindings = { -- Bind 'Up' event of CTRL-Click to open hyperlinks { event={Up={streak=1, button="Left"}}, mods="CTRL", - action="OpenLinkAtMouseCursor", + action=act.OpenLinkAtMouseCursor, }, -- Disable the 'Down' event of CTRL-Click to avoid weird program behaviors { event={Down={streak=1, button="Left"}}, mods="CTRL", - action="Nop", + action=act.Nop, }, }, } @@ -156,5 +162,3 @@ return { See the [`KeyAssignment` reference](lua/keyassignment/index.md) for information on available actions. - - diff --git a/docs/copymode.md b/docs/copymode.md index 03d8f63e6..41f969ac0 100644 --- a/docs/copymode.md +++ b/docs/copymode.md @@ -81,72 +81,72 @@ 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=wezterm.action{CopyMode="Close"}}, - {key="g", mods="CTRL", action=wezterm.action{CopyMode="Close"}}, - {key="q", mods="NONE", action=wezterm.action{CopyMode="Close"}}, - {key="Escape", mods="NONE", action=wezterm.action{CopyMode="Close"}}, + {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=wezterm.action{CopyMode="MoveLeft"}}, - {key="j", mods="NONE", action=wezterm.action{CopyMode="MoveDown"}}, - {key="k", mods="NONE", action=wezterm.action{CopyMode="MoveUp"}}, - {key="l", mods="NONE", action=wezterm.action{CopyMode="MoveRight"}}, + {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=wezterm.action{CopyMode="MoveLeft"}}, - {key="DownArrow", mods="NONE", action=wezterm.action{CopyMode="MoveDown"}}, - {key="UpArrow", mods="NONE", action=wezterm.action{CopyMode="MoveUp"}}, - {key="RightArrow", mods="NONE", action=wezterm.action{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=wezterm.action{CopyMode="MoveForwardWord"}}, - {key="f", mods="ALT", action=wezterm.action{CopyMode="MoveForwardWord"}}, - {key="Tab", mods="NONE", action=wezterm.action{CopyMode="MoveForwardWord"}}, - {key="w", mods="NONE", action=wezterm.action{CopyMode="MoveForwardWord"}}, + {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=wezterm.action{CopyMode="MoveBackwardWord"}}, - {key="b", mods="ALT", action=wezterm.action{CopyMode="MoveBackwardWord"}}, - {key="Tab", mods="SHIFT", action=wezterm.action{CopyMode="MoveBackwardWord"}}, - {key="b", mods="NONE", action=wezterm.action{CopyMode="MoveBackwardWord"}}, + {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=wezterm.action{CopyMode="MoveToStartOfLine"}}, - {key="Enter", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfNextLine"}}, - {key="$", mods="NONE", action=wezterm.action{CopyMode="MoveToEndOfLineContent"}}, - {key="$", mods="SHIFT", action=wezterm.action{CopyMode="MoveToEndOfLineContent"}}, + {key="0", mods="NONE", action=act.CopyMode("MoveToStartOfLine")}, + {key="Enter", mods="NONE", action=act.CopyMode("MoveToStartOfNextLine")}, - {key="m", mods="ALT", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}}, - {key="^", mods="NONE", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}}, - {key="^", mods="SHIFT", action=wezterm.action{CopyMode="MoveToStartOfLineContent"}}, + {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=wezterm.action{CopyMode={SetSelectionMode="Cell"}}}, - {key="v", mods="NONE", action=wezterm.action{CopyMode={SetSelectionMode="Cell"}}}, - {key="V", mods="NONE", action=wezterm.action{CopyMode={SetSelectionMode="Line"}}}, - {key="V", mods="SHIFT", action=wezterm.action{CopyMode={SetSelectionMode="Line"}}}, - {key="v", mods="CTRL", action=wezterm.action{CopyMode={SetSelectionMode="Block"}}}, + {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=wezterm.action{CopyMode="MoveToScrollbackBottom"}}, - {key="G", mods="SHIFT", action=wezterm.action{CopyMode="MoveToScrollbackBottom"}}, - {key="g", mods="NONE", action=wezterm.action{CopyMode="MoveToScrollbackTop"}}, + {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=wezterm.action{CopyMode="MoveToViewportTop"}}, - {key="H", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportTop"}}, - {key="M", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportMiddle"}}, - {key="M", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportMiddle"}}, - {key="L", mods="NONE", action=wezterm.action{CopyMode="MoveToViewportBottom"}}, - {key="L", mods="SHIFT", action=wezterm.action{CopyMode="MoveToViewportBottom"}}, + {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=wezterm.action{CopyMode="MoveToSelectionOtherEnd"}}, - {key="O", mods="NONE", action=wezterm.action{CopyMode="MoveToSelectionOtherEndHoriz"}}, - {key="O", mods="SHIFT", action=wezterm.action{CopyMode="MoveToSelectionOtherEndHoriz"}}, + {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=wezterm.action{CopyMode="PageUp"}}, - {key="PageDown", mods="NONE", action=wezterm.action{CopyMode="PageDown"}}, + {key="PageUp", mods="NONE", action=act.CopyMode("PageUp")}, + {key="PageDown", mods="NONE", action=act.CopyMode("PageDown")}, - {key="b", mods="CTRL", action=wezterm.action{CopyMode="PageUp"}}, - {key="f", mods="CTRL", action=wezterm.action{CopyMode="PageDown"}}, - } + {key="b", mods="CTRL", action=act.CopyMode("PageUp")}, + {key="f", mods="CTRL", action=act.CopyMode("PageDown")}, + }, }, } ``` - diff --git a/docs/scrollback.md b/docs/scrollback.md index de9582254..a2895da28 100644 --- a/docs/scrollback.md +++ b/docs/scrollback.md @@ -98,20 +98,21 @@ 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=wezterm.action{CopyMode="Close"}}, - {key="UpArrow", mods="NONE", action=wezterm.action{CopyMode="PriorMatch"}}, - {key="Enter", mods="NONE", action=wezterm.action{CopyMode="PriorMatch"}}, - {key="p", mods="CTRL", action=wezterm.action{CopyMode="PriorMatch"}}, - {key="PageUp", mods="NONE", action=wezterm.action{CopyMode="PriorMatchPage"}}, - {key="PageDown", mods="NONE", action=wezterm.action{CopyMode="NextMatchPage"}}, - {key="n", mods="CTRL", action=wezterm.action{CopyMode="NextMatchPage"}}, - {key="DownArrow", mods="NONE", action=wezterm.action{CopyMode="NextMatch"}}, - {key="r", mods="CTRL", action=wezterm.action{CopyMode="CycleMatchType"}}, - {key="u", mods="CTRL", action=wezterm.action{CopyMode="ClearPattern"}}, + {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")}, } } } @@ -135,7 +136,7 @@ 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,}"}}}, + {key="H", mods="SHIFT|CTRL", action=wezterm.action.Search{Regex="[a-f0-9]{6,}"}}, }, } ```