summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 16:35:27 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commite87e16547a17864b2a0cd574c1aa42d44125bc6c (patch)
tree45a35aec572bc141c008bc6c17c7a2d5acf6a653 /src/config.zig
parent79cdf76fd2dd0ba03622bfe742b525b770d51684 (diff)
downloadpardes-e87e16547a17864b2a0cd574c1aa42d44125bc6c.tar.gz
pardes-e87e16547a17864b2a0cd574c1aa42d44125bc6c.zip
Alt-o, Alt-i and the other tree-sitter keys walk the file's syntax tree
helix's expand/shrink, previous/next sibling, all siblings, all children and parent-node end/start (Alt-o/up, Alt-i/down, Alt-p/left, Alt-right, Alt-a, Alt-I, Alt-e, Alt-b; Alt-n stays the new terminal) walk a whole-file parse the file keeps (File.node_tree), made on the first such key after an edit and reused until the next, never per key. syntax.walkNodes follows helix's TreeCursor over every node, anonymous ones included, and Alt-i goes back to what Alt-o grew from while the selection still holds it. The harness runs without grammars, so the cases prove the plain-text no-op; a test replays eleven JSON walks whose results were taken from the installed hx. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config.zig b/src/config.zig
index 8c5c9771..959f4c4a 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -537,6 +537,16 @@ pub const split_regex: []const Chord = &.{.{ .cp = 'S' }};
pub const keep_regex: []const Chord = &.{.{ .cp = 'K' }};
pub const remove_regex: []const Chord = &.{.{ .cp = 'K', .alt = true }};
pub const ensure_forward: []const Chord = &.{.{ .cp = ':', .alt = true }};
+// helix's tree-sitter selection; Alt-n stays the new terminal, so the next
+// sibling is Alt-right alone
+pub const expand_node: []const Chord = &.{ .{ .cp = 'o', .alt = true }, .{ .cp = Key.up, .alt = true } };
+pub const shrink_node: []const Chord = &.{ .{ .cp = 'i', .alt = true }, .{ .cp = Key.down, .alt = true } };
+pub const prev_sibling: []const Chord = &.{ .{ .cp = 'p', .alt = true }, .{ .cp = Key.left, .alt = true } };
+pub const next_sibling: []const Chord = &.{.{ .cp = Key.right, .alt = true }};
+pub const all_siblings: []const Chord = &.{.{ .cp = 'a', .alt = true }};
+pub const all_children: []const Chord = &.{.{ .cp = 'I', .alt = true }};
+pub const parent_node_end: []const Chord = &.{.{ .cp = 'e', .alt = true }};
+pub const parent_node_start: []const Chord = &.{.{ .cp = 'b', .alt = true }};
pub const delete: []const Chord = &.{.{ .cp = 'd' }};
pub const delete_noyank: []const Chord = &.{.{ .cp = 'd', .alt = true }};