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

@@ -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"}},
}
}
```