From dd88be893e85c7d3b43c89846fd25e33a72902e2 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 27 Nov 2025 16:57:59 +0100 Subject: [PATCH] refactor: add explicit command for initializing helix select mode --- src/keybind/builtin/helix.json | 2 +- src/tui/mode/helix.zig | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/keybind/builtin/helix.json b/src/keybind/builtin/helix.json index a784717..3e5bbd8 100644 --- a/src/keybind/builtin/helix.json +++ b/src/keybind/builtin/helix.json @@ -282,7 +282,7 @@ "line_numbers": "relative", "cursor": "block", "selection": "inclusive", - "init_command": ["enable_selection"], + "init_command": ["init_helix_select_mode"], "press": [ ["ctrl+b", "select_page_up"], diff --git a/src/tui/mode/helix.zig b/src/tui/mode/helix.zig index 20ca66f..8580ac1 100644 --- a/src/tui/mode/helix.zig +++ b/src/tui/mode/helix.zig @@ -240,6 +240,12 @@ const cmds_ = struct { } pub const extend_line_below_meta: Meta = .{ .arguments = &.{.integer}, .description = "Select current line, if already selected, extend to next line" }; + pub fn init_helix_select_mode(_: *void, _: Ctx) Result { + _, const ed = get_context() orelse return; + try ed.enable_selection(.{}); + } + pub const init_helix_select_mode_meta: Meta = .{}; + pub fn move_next_word_start(_: *void, ctx: Ctx) Result { try move_to_word(ctx, Editor.move_cursor_word_right_vim, .forwards); }