summaryrefslogtreecommitdiff
path: root/src/modal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 15:59:00 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit767aefd1e1cfd79e2a240a59d2d16bfb326f062d (patch)
tree113c66e3abda3548056fc480d7c7eeedbdaeb025 /src/modal.zig
parentab1c353f65efe8741b9a4d1aaef065af0aee885a (diff)
downloadpardes-767aefd1e1cfd79e2a240a59d2d16bfb326f062d.tar.gz
pardes-767aefd1e1cfd79e2a240a59d2d16bfb326f062d.zip
Registers hold a value per range, and "<reg> names one
Registers.zig replaces the one yank buffer: every register keeps a value per range, y fills them in document order, and p, P, R and insert Ctrl-r put value i at range i, repeating the last (helix paste_impl). "<reg> names the register for the next command; _ swallows, # numbers the ranges, . is each range's text, % the file's name, / the last s/S pattern, and + and * are the system clipboard through the ClipYank and ClipPaste paths. SPC y now writes + alone, as helix's does. The acme chords and a paste into a terminal take the default register joined by newlines. The msel-yank-paste waiver is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/modal.zig')
-rw-r--r--src/modal.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/modal.zig b/src/modal.zig
index aadaab00..aec1c579 100644
--- a/src/modal.zig
+++ b/src/modal.zig
@@ -15,6 +15,7 @@ pub const Normal = struct {
prefix_replace,
prefix_next,
prefix_prev,
+ prefix_register,
goto_file_start,
goto_last_line,
@@ -160,6 +161,7 @@ pub const Normal = struct {
replace,
next,
prev,
+ register,
};
pub const MatchSub = enum(u8) {
@@ -176,6 +178,8 @@ pub const Normal = struct {
prefix: Prefix = .none,
match_sub: MatchSub = .none,
held_char: u21 = 0,
+ /// `"<reg>`: the register the next command names, 0 for none
+ register: u21 = 0,
pub fn clear(state: *State) void {
state.* = .{};
@@ -491,6 +495,14 @@ pub const Normal = struct {
if (key.has(.goto_diagnostic_end)) return resultAction(.{ .diagnostic = .{ .direction = direction, .endpoint = true } });
return .ignored;
},
+ .register => {
+ state.prefix = .none;
+ const char = key.literal() orelse return .ignored;
+ state.register = char;
+ // the count typed before `"` is still the command's
+ state.count = if (counted.explicit) count else 0;
+ return .pending;
+ },
.none => {},
}
@@ -505,6 +517,7 @@ pub const Normal = struct {
if (key.has(.prefix_next)) return armPrefix(state, .next, if (counted.explicit) count else 0);
if (key.has(.prefix_prev)) return armPrefix(state, .prev, if (counted.explicit) count else 0);
if (key.has(.prefix_match)) return armPrefix(state, .match, 0);
+ if (key.has(.prefix_register)) return armPrefix(state, .register, if (counted.explicit) count else 0);
if (key.has(.move_left)) return resultAction(.{ .move = .{ .motion = .left, .count = count } });
if (key.has(.move_right)) return resultAction(.{ .move = .{ .motion = .right, .count = count } });