From 609c707e91abc1cc1b307f4c583aa98feca49e50 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 16 Aug 2020 08:19:00 -0700 Subject: [PATCH] docs: add example for SendString + escape sequences closes: https://github.com/wez/wezterm/issues/253 --- docs/config/keys.markdown | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/config/keys.markdown b/docs/config/keys.markdown index ea09461d5..a721f396e 100644 --- a/docs/config/keys.markdown +++ b/docs/config/keys.markdown @@ -491,6 +491,23 @@ return { } ``` +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: + +```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