Skip to content

Commit 4ce4c43

Browse files
authored
Merge branch 'main' into feat/lantern
2 parents 8214a23 + c82058e commit 4ce4c43

7 files changed

Lines changed: 268 additions & 1 deletion

File tree

.github/workflows/panvimdoc_plugins.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ jobs:
9494
ignorerawblocks: true
9595
docmapping: false
9696
docmappingprojectname: false
97+
- name: Run panvimdoc for chord.md
98+
uses: kdheepak/panvimdoc@v4.0.1
99+
with:
100+
vimdoc: wezterm-types-plugin.chord
101+
description: "`chord` types"
102+
pandoc: docs/chord.md
103+
toc: false
104+
demojify: true
105+
dedupsubheadings: false
106+
treesitter: true
107+
ignorerawblocks: true
108+
docmapping: false
109+
docmappingprojectname: false
97110
- name: Run panvimdoc for cmd-sender.md
98111
uses: kdheepak/panvimdoc@v4.0.1
99112
with:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ This project also features type annotations for various WezTerm plugins.
7373
| [ai-helper.wezterm](https://github.com/Michal1993r/ai-helper.wezterm) | [docs/ai-helper.md](./docs/ai-helper.md) | [:h wezterm-types-plugin.ai-helper.txt](./doc/wezterm-types-plugin.ai-helper.txt) |
7474
| [bar.wezterm](https://github.com/adriankarlen/bar.wezterm) | [docs/bar.md](./docs/bar.md) | [:h wezterm-types-plugin.bar.txt](./doc/wezterm-types-plugin.bar.txt) |
7575
| [battery.wez](https://github.com/rootiest/battery.wez) | [docs/battery.md](./docs/battery.md) | [:h wezterm-types-plugin.battery.txt](./doc/wezterm-types-plugin.battery.txt) |
76+
| [chord.wz](https://github.com/sravioli/chord.wz) | [docs/chord.md](./docs/chord.md) | [:h wezterm-types-plugin.chord.txt](./doc/wezterm-types-plugin.chord.txt) |
7677
| [dev.wezterm](https://github.com/ChrisGVE/dev.wezterm) | [docs/dev.md](./docs/dev.md) | [:h wezterm-types-plugin.dev.txt](./doc/wezterm-types-plugin.dev.txt) |
7778
| [kanagawa.wz](https://github.com/sravioli/kanagawa.wz) | [docs/kanagawa.md](./docs/kanagawa.md) | [:h wezterm-types-plugin.kanagawa.txt](./doc/wezterm-types-plugin.kanagawa.txt) |
7879
| [lantern.wz](https://github.com/sravioli/lantern.wz) | [docs/lantern.md](./docs/lantern.md) | [:h wezterm-types-plugin.lantern.txt](./doc/wezterm-types-plugin.lantern.txt) |

doc/wezterm-types-plugin.chord.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*wezterm-types-plugin.chord.txt* `chord` types
2+
3+
CHORD.WZ ~
4+
5+
You can import type annotations for `sravioli/chord.wz`
6+
<https://github.com/sravioli/chord.wz> as shown below:
7+
8+
>lua
9+
---@type Chord
10+
local chord = wezterm.plugin.require("https://github.com/sravioli/chord.wz")
11+
<
12+
13+
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
14+
15+
vim:tw=78:ts=8:noet:ft=help:norl:

doc/wezterm-types.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*wezterm-types.txt* For NVIM >=v0.7.0 Last change: 2026 April 25
1+
*wezterm-types.txt* For NVIM >=v0.7.0 Last change: 2026 May 11
22

33
==============================================================================
44
1. wezterm-types *wezterm-types-wezterm-types*
@@ -87,6 +87,8 @@ This project also features type annotations for various WezTerm plugins.
8787

8888
battery.wez docs/battery.md :h wezterm-types-plugin.battery.txt
8989

90+
chord.wz docs/chord.md :h wezterm-types-plugin.chord.txt
91+
9092
dev.wezterm docs/dev.md :h wezterm-types-plugin.dev.txt
9193

9294
kanagawa.wz docs/kanagawa.md :h wezterm-types-plugin.kanagawa.txt

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ We will keep adding more community plugins as we find them.
99
- [ai-helper.wezterm](./ai-helper.md)
1010
- [bar.wezterm](./bar.md)
1111
- [battery.wez](./battery.md)
12+
- [chord.wz](./chord.md)
1213
- [dev.wezterm](./dev.md)
1314
- [kanagawa.wz](./kanagawa.md)
1415
- [lantern.wz](./lantern.md)

docs/chord.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### `chord.wz`
2+
3+
You can import type annotations for
4+
[`sravioli/chord.wz`](https://github.com/sravioli/chord.wz) as shown below:
5+
6+
```lua
7+
---@type Chord
8+
local chord = wezterm.plugin.require("https://github.com/sravioli/chord.wz")
9+
```
10+
11+
<!-- vim: set ts=2 sts=2 sw=2 et ai si sta: -->
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
---@meta
2+
---@diagnostic disable:unused-local
3+
4+
---@class Chord.KeyEntry
5+
---@field key string WezTerm key name.
6+
---@field mods? string WezTerm modifier string, such as `CTRL|SHIFT`.
7+
---@field action any WezTerm action assigned to the key.
8+
---@field desc? string Optional command-palette or hint-bar description.
9+
10+
---@class Chord.VimMapping
11+
---@field [1]? string Vim-style left-hand side, such as `<C-Space>`.
12+
---@field [2]? any WezTerm action.
13+
---@field [3]? string Optional description.
14+
---@field lhs? string Vim-style left-hand side.
15+
---@field rhs? any WezTerm action.
16+
---@field action? any WezTerm action.
17+
---@field desc? string Optional description.
18+
19+
---@class Chord.OverrideSpec
20+
---@field enabled? boolean Disable a mapping group when set to `false`.
21+
---@field disable? (string|Chord.KeyEntry|Chord.VimMapping)[] Mappings to remove.
22+
---@field override? table<string, any> Mappings to replace by Vim-style lhs.
23+
---@field add? Chord.VimMapping[] Mappings to append.
24+
25+
---@class Chord.Overrides
26+
---@field enabled? { keys?: boolean, key_tables?: boolean }
27+
---@field keys? Chord.OverrideSpec
28+
---@field key_tables? table<string, Chord.OverrideSpec>
29+
30+
---@class Chord.KeyMeta
31+
---@field i string Short icon or label for the key table.
32+
---@field txt string Display text for the key table.
33+
---@field bg string Background color for the key table.
34+
---@field pad? integer Optional display padding.
35+
---@field name? string Runtime key-table name.
36+
37+
---@class Chord.KeyTableDef
38+
---@field meta Chord.KeyMeta Key-table metadata used by hints and mode displays.
39+
---@field keys Chord.VimMapping[] Key definitions in Vim-style notation.
40+
41+
---@alias Chord.KeyTableDefFn fun(theme: table): Chord.KeyTableDef
42+
43+
---@class Chord.HintsConfig
44+
---@field separator string Separator between hint entries.
45+
---@field page_cache_prefix string Prefix for per-pane hint page cache keys.
46+
47+
---@class Chord.CommandConfig
48+
---@field key string Key binding that opens the command picker.
49+
---@field desc string Description for the injected command picker binding.
50+
---@field title string InputSelector title.
51+
---@field fuzzy boolean Whether InputSelector fuzzy matching is enabled.
52+
---@field description string InputSelector description.
53+
---@field fuzzy_description string InputSelector fuzzy description.
54+
---@field alphabet? string InputSelector shortcut alphabet.
55+
---@field include_registered boolean Include commands registered through `chord.command.register`.
56+
---@field include_keys boolean Include top-level `config.keys` entries.
57+
---@field include_key_tables boolean Include `config.key_tables` entries.
58+
---@field include_defaults boolean Include `wezterm.gui.default_keys()` entries.
59+
---@field include_undocumented boolean Include entries without `desc` or `label`.
60+
---@field dedupe boolean Dedupe entries by binding identity.
61+
62+
---@class Chord.LogConfig
63+
---@field enabled boolean
64+
---@field threshold string|integer
65+
66+
---@class Chord.Config
67+
---@field aliases table<string, string> Vim-style key aliases mapped to WezTerm key names.
68+
---@field modifiers table<string, string> Vim-style modifier aliases mapped to WezTerm modifiers.
69+
---@field leader string Leader token used in Vim-style key notation.
70+
---@field hints Chord.HintsConfig
71+
---@field command Chord.CommandConfig
72+
---@field log Chord.LogConfig
73+
74+
---@alias Chord.CommandSource "registered"|"keys"|"key_table"|"default"
75+
76+
---@class Chord.Command
77+
---@field id string Stable command identifier.
78+
---@field label string User-facing command label.
79+
---@field action any WezTerm action executed when the command is selected.
80+
---@field lhs? string Vim-style key label, when the command is key-backed.
81+
---@field source Chord.CommandSource Source collection where the command came from.
82+
---@field table_name? string Key table name for `key_table` commands.
83+
---@field binding_id? string Normalized binding identity used for deduplication.
84+
85+
---@class Chord.CommandSpec
86+
---@field [1]? string Vim-style left-hand side.
87+
---@field [2]? any WezTerm action.
88+
---@field [3]? string Optional command label.
89+
---@field id? string Stable command identifier.
90+
---@field label? string User-facing command label.
91+
---@field desc? string User-facing command label.
92+
---@field lhs? string Vim-style left-hand side.
93+
---@field key? string Native WezTerm key name.
94+
---@field mods? string Native WezTerm modifier string.
95+
---@field rhs? any WezTerm action.
96+
---@field action? any WezTerm action.
97+
98+
---@class Chord.CommandApi
99+
local Command = {}
100+
101+
---Clear commands registered through `chord.command.register`.
102+
function Command.clear() end
103+
104+
---Register an action-only command or a key-backed command.
105+
---@param spec Chord.CommandSpec
106+
---@return Chord.Command|nil command
107+
function Command.register(spec) end
108+
109+
---Register many commands.
110+
---@param specs Chord.CommandSpec[]
111+
function Command.register_many(specs) end
112+
113+
---Collect commands from registered entries, config keys, key tables, and defaults.
114+
---@param config_table table WezTerm config table.
115+
---@param opts? table Command options merged over `Chord.CommandConfig`.
116+
---@return Chord.Command[] commands
117+
function Command.collect(config_table, opts) end
118+
119+
---Return a WezTerm action that opens the command picker.
120+
---@param config_table table WezTerm config table.
121+
---@param opts? table Command options merged over `Chord.CommandConfig`.
122+
---@return table action
123+
function Command.action(config_table, opts) end
124+
125+
---Inject a trigger binding that opens the command picker.
126+
---@param config_table table WezTerm config table.
127+
---@param opts? table Command options merged over `Chord.CommandConfig`.
128+
---@return table action
129+
function Command.apply(config_table, opts) end
130+
131+
---@class Chord
132+
---@field aliases table<string, string>
133+
---@field modifiers table<string, string>
134+
---@field command Chord.CommandApi
135+
local M = {}
136+
137+
---Configure Chord.
138+
---@param opts? table Partial Chord configuration.
139+
---@return Chord chord Public API.
140+
function M.setup(opts) end
141+
142+
---Return the active Chord configuration.
143+
---@return Chord.Config config
144+
function M.config() end
145+
146+
---Validate a Vim-style key expression.
147+
---@param lhs string Vim-style key expression.
148+
---@return boolean valid
149+
---@return string|nil error_message
150+
function M.validate(lhs) end
151+
152+
---Normalize a Vim-style key expression to a WezTerm key entry fragment.
153+
---@param lhs string Vim-style key expression.
154+
---@return table|nil entry
155+
---@return string|nil error_message
156+
function M.normalize(lhs) end
157+
158+
---Create a WezTerm key entry from either native syntax or Vim-style syntax.
159+
---@param lhs_or_spec string|Chord.VimMapping|Chord.KeyEntry
160+
---@param action? any WezTerm action when `lhs_or_spec` is a string.
161+
---@param desc? string Optional description.
162+
---@return Chord.KeyEntry|nil entry
163+
function M.key(lhs_or_spec, action, desc) end
164+
165+
---Append a single key mapping to a target table.
166+
---@param lhs_or_spec string|Chord.VimMapping|Chord.KeyEntry
167+
---@param action any WezTerm action.
168+
---@param target table Target list to mutate.
169+
function M.map(lhs_or_spec, action, target) end
170+
171+
---Append a batch of key mappings to a target table.
172+
---@param mappings (Chord.VimMapping|Chord.KeyEntry)[]
173+
---@param target table Target list to mutate.
174+
function M.map_batch(mappings, target) end
175+
176+
---Convert Vim-style mappings to a WezTerm key table.
177+
---@param mappings (Chord.VimMapping|Chord.KeyEntry)[]
178+
---@return Chord.KeyEntry[] key_table
179+
function M.table(mappings) end
180+
181+
---Append mappings to `config.keys`.
182+
---@param config_table table WezTerm config table.
183+
---@param mappings (Chord.VimMapping|Chord.KeyEntry)[]
184+
function M.maps(config_table, mappings) end
185+
186+
---Register modal key tables and write them into `config.key_tables`.
187+
---@param config_table table WezTerm config table.
188+
---@param defs table<string, Chord.KeyTableDef|Chord.KeyTableDefFn>
189+
function M.tables(config_table, defs) end
190+
191+
---Apply user overrides to already-built keys and key tables.
192+
---@param config_table table WezTerm config table.
193+
---@param overrides Chord.Overrides
194+
function M.apply_overrides(config_table, overrides) end
195+
196+
---Return registered key-table metadata for mode displays.
197+
---@param theme table Theme or color table passed to key-table definition functions.
198+
---@return table<string, Chord.KeyMeta> modes
199+
function M.get_modes(theme) end
200+
201+
---Render a plain-text key-hint bar for the active key table.
202+
---@param config_table table WezTerm config table.
203+
---@param name? string Key-table name. `nil` uses top-level keys.
204+
---@param width_cols integer Available terminal columns.
205+
---@param window Window WezTerm window.
206+
---@return string hint
207+
function M.hint(config_table, name, width_cols, window) end
208+
209+
---Render a Ribbon key-hint bar for the active key table.
210+
---@param config_table table WezTerm config table.
211+
---@param name? string Key-table name. `nil` uses top-level keys.
212+
---@param width_cols integer Available terminal columns.
213+
---@param window Window WezTerm window.
214+
---@param opts { theme: table, mode_bg: string }
215+
---@return Ribbon layout
216+
function M.hint_layout(config_table, name, width_cols, window, opts) end
217+
218+
---Return an action callback that changes the visible hint page.
219+
---@param name? string Key-table name.
220+
---@param direction integer Page delta.
221+
---@return table action
222+
function M.hint_action(name, direction) end
223+
224+
-- vim: set ts=2 sts=2 sw=2 et ai si sta:

0 commit comments

Comments
 (0)