From ea228d1b832401db8efe33a5db4099ba41d42509 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 31 Jul 2026 00:26:12 -0300 Subject: config.zig: every binding and every piece of Look syntax in one file Retargeting a key, a mouse chord or a spelling is now an edit to src/config.zig and nothing else. Three parts in reading order: pardes's own bindings (where a reader lands), the Look/Exec syntax, then the helix keymap under a banner saying hxdiff/hxparity are differential suites against real helix, so a key moved there is a divergence and not a tweak. The bindings are data a comptime loop can walk, because the builtin index is going to walk them. Duplication this cut: is/isC/isA became one hit(key, chords) over ~132 call sites, and a binding being a LIST collapses the letter-or-arrow chains; swap_enter_tab is gone, replaced by look_key/exec_key that can point anywhere; the four focus builtins' h/j/k/l lived hardcoded in two places and is now one table. No golden moved. --- src/builtins.zig | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 7143a860..d32e4ed3 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -21,15 +21,16 @@ //! table catches immediately (see leader_path: a missing key path is a //! compile error). //! -//! What is NOT here: the key bindings. `leader_path` stays ONE table in -//! pardes.zig next to `topbar_str` — the whole remapping surface belongs in -//! one place a user can read top to bottom, not scattered a line at a time -//! across thirty-three structs. +//! What is NOT here: the key bindings. `leader_path` is ONE table in +//! config.zig next to `topbar_str` and every other syntactic choice — the +//! whole remapping surface belongs in one file a user can read top to bottom, +//! not scattered a line at a time across thirty-three structs. const std = @import("std"); const pardes = @import("pardes.zig"); const Pardes = pardes.Pardes; const Pane = pardes.Pane; const output_pane = @import("output_pane.zig"); +const config = @import("config.zig"); /// What a builtin gets to act on. One bundle rather than five parameters /// because most builtins want two of them and zig rejects the unused rest. @@ -273,7 +274,7 @@ pub const Find = struct { pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (pat.len > 0) return c.p.runSearch(c.id, pat, .find); - c.p.startSearch(c.pane, Pardes.find_marker); + c.p.startSearch(c.pane, config.find_marker); } }; @@ -283,7 +284,7 @@ pub const Grep = struct { pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (pat.len > 0) return c.p.runSearch(c.id, pat, .grep); - c.p.startSearch(c.pane, Pardes.grep_marker); + c.p.startSearch(c.pane, config.grep_marker); } }; @@ -412,7 +413,7 @@ pub const Rename = struct { pub fn run(c: Ctx) void { const a = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (a.len > 0) return c.p.lspRequest(c.id, .rename, a); - c.p.startSearch(c.pane, Pardes.rename_marker); + c.p.startSearch(c.pane, config.rename_marker); } }; @@ -420,7 +421,7 @@ pub const WsSymbols = struct { pub fn run(c: Ctx) void { const a = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (a.len > 0) return c.p.lspRequest(c.id, .workspace_symbols, a); - c.p.startSearch(c.pane, Pardes.symbol_marker); + c.p.startSearch(c.pane, config.symbol_marker); } }; -- cgit v1.3