summaryrefslogtreecommitdiff
path: root/src/modal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 15:31:55 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit4315121885bebd48f8c03a2b1c7b0bd943c67afd (patch)
treeb9072c654cd486a7e817c7c3377bc49716e3afd2 /src/modal.zig
parente35e4654c34cf303cf3bc6077a3cbffee70f7909 (diff)
downloadpardes-4315121885bebd48f8c03a2b1c7b0bd943c67afd.tar.gz
pardes-4315121885bebd48f8c03a2b1c7b0bd943c67afd.zip
Alt-J joins lines and selects the spaces it put in
helix-golf's text_into_array turns lines into an array with %<A-s>ms"<A-J>i,: join_selections_space joins like J and leaves one cursor on each space it inserted. J and Alt-J now make one edit over every range, as helix does, rather than J being replayed per range; that is what lets Alt-J hand back all the spaces as the new selection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/modal.zig')
-rw-r--r--src/modal.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modal.zig b/src/modal.zig
index 3827d11f..0e6aba61 100644
--- a/src/modal.zig
+++ b/src/modal.zig
@@ -108,6 +108,7 @@ pub const Normal = struct {
to_lowercase,
to_uppercase,
join_lines,
+ join_select_space,
indent,
unindent,
format,
@@ -260,6 +261,7 @@ pub const Normal = struct {
lowercase,
uppercase,
join_lines,
+ join_select_space,
indent,
unindent,
comment_toggle,
@@ -317,7 +319,7 @@ pub const Normal = struct {
.search_step,
=> .once,
.edit => |edit| switch (edit.kind) {
- .comment_toggle, .undo, .redo => .once,
+ .join_lines, .join_select_space, .comment_toggle, .undo, .redo => .once,
else => .per_selection,
},
else => .per_selection,
@@ -549,6 +551,7 @@ pub const Normal = struct {
if (key.has(.to_lowercase)) return resultAction(.{ .edit = .{ .kind = .lowercase, .count = count } });
if (key.has(.to_uppercase)) return resultAction(.{ .edit = .{ .kind = .uppercase, .count = count } });
if (key.has(.join_lines)) return resultAction(.{ .edit = .{ .kind = .join_lines, .count = count } });
+ if (key.has(.join_select_space)) return resultAction(.{ .edit = .{ .kind = .join_select_space, .count = count } });
if (key.has(.indent)) return resultAction(.{ .edit = .{ .kind = .indent, .count = count } });
if (key.has(.unindent)) return resultAction(.{ .edit = .{ .kind = .unindent, .count = count } });
if (key.has(.format)) return resultAction(.{ .lsp = .format });