From a8c056c21188d846a7713555872a168b9df46828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20T=C3=A1mara?= Date: Wed, 29 Oct 2025 22:18:47 -0500 Subject: [PATCH] feat: hx extend word to right --- src/tui/mode/helix.zig | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/tui/mode/helix.zig b/src/tui/mode/helix.zig index f7ec14d..336a3c1 100644 --- a/src/tui/mode/helix.zig +++ b/src/tui/mode/helix.zig @@ -233,6 +233,16 @@ const cmds_ = struct { } pub const move_next_word_start_meta: Meta = .{ .description = "Move next word start", .arguments = &.{.integer} }; + pub fn extend_next_word_start(_: *void, ctx: Ctx) Result { + const mv = tui.mainview() orelse return; + const ed = mv.get_active_editor() orelse return; + const root = try ed.buf_root(); + + ed.with_selections_const_repeat(root, Editor.move_cursor_word_right_vim, ctx) catch {}; + ed.clamp(); + } + pub const extend_next_word_start_meta: Meta = .{ .description = "Extend next word start", .arguments = &.{.integer} }; + pub fn move_next_long_word_start(_: *void, ctx: Ctx) Result { const mv = tui.mainview() orelse return; const ed = mv.get_active_editor() orelse return; @@ -247,6 +257,16 @@ const cmds_ = struct { } pub const move_next_long_word_start_meta: Meta = .{ .description = "Move next long word start", .arguments = &.{.integer} }; + pub fn extend_next_long_word_start(_: *void, ctx: Ctx) Result { + const mv = tui.mainview() orelse return; + const ed = mv.get_active_editor() orelse return; + const root = try ed.buf_root(); + + ed.with_selections_const_repeat(root, move_cursor_long_word_right, ctx) catch {}; + ed.clamp(); + } + pub const extend_next_long_word_start_meta: Meta = .{ .description = "Extend next long word start", .arguments = &.{.integer} }; + pub fn move_prev_word_start(_: *void, ctx: Ctx) Result { const mv = tui.mainview() orelse return; const ed = mv.get_active_editor() orelse return; @@ -289,6 +309,16 @@ const cmds_ = struct { } pub const move_next_word_end_meta: Meta = .{ .description = "Move next word end", .arguments = &.{.integer} }; + pub fn extend_next_word_end(_: *void, ctx: Ctx) Result { + const mv = tui.mainview() orelse return; + const ed = mv.get_active_editor() orelse return; + const root = try ed.buf_root(); + + ed.with_selections_const_repeat(root, move_cursor_word_right_end_helix, ctx) catch {}; + ed.clamp(); + } + pub const extend_next_word_end_meta: Meta = .{ .description = "Extend next word end", .arguments = &.{.integer} }; + pub fn move_next_long_word_end(_: *void, ctx: Ctx) Result { const mv = tui.mainview() orelse return; const ed = mv.get_active_editor() orelse return; @@ -303,6 +333,16 @@ const cmds_ = struct { } pub const move_next_long_word_end_meta: Meta = .{ .description = "Move next long word end", .arguments = &.{.integer} }; + pub fn extend_next_long_word_end(_: *void, ctx: Ctx) Result { + const mv = tui.mainview() orelse return; + const ed = mv.get_active_editor() orelse return; + const root = try ed.buf_root(); + + ed.with_selections_const_repeat(root, move_cursor_long_word_right_end, ctx) catch {}; + ed.clamp(); + } + pub const extend_next_long_word_end_meta: Meta = .{ .description = "Extend next long word end", .arguments = &.{.integer} }; + pub fn cut_forward_internal_inclusive(_: *void, _: Ctx) Result { const mv = tui.mainview() orelse return; const ed = mv.get_active_editor() orelse return;