diff --git a/src/keybind/builtin/helix.json b/src/keybind/builtin/helix.json index 1225b17..5da5755 100644 --- a/src/keybind/builtin/helix.json +++ b/src/keybind/builtin/helix.json @@ -120,7 +120,7 @@ ["v", "enter_mode", "select"], - ["g g", "goto_line_vim"], + ["g g", "move_buffer_begin"], ["g e", "move_buffer_end"], ["g f", "goto_file"], ["g h", "move_begin"], @@ -225,16 +225,15 @@ ["space h", "select_references_to_symbol_under_cursor"], ["space c", "toggle_comment"], - ["0", "add_integer_argument_digit", 0], - ["1", "add_integer_argument_digit", 1], - ["2", "add_integer_argument_digit", 2], - ["3", "add_integer_argument_digit", 3], - ["4", "add_integer_argument_digit", 4], - ["5", "add_integer_argument_digit", 5], - ["6", "add_integer_argument_digit", 6], - ["7", "add_integer_argument_digit", 7], - ["8", "add_integer_argument_digit", 8], - ["9", "add_integer_argument_digit", 9] + ["1", "add_count", 1], + ["2", "add_count", 2], + ["3", "add_count", 3], + ["4", "add_count", 4], + ["5", "add_count", 5], + ["6", "add_count", 6], + ["7", "add_count", 7], + ["8", "add_count", 8], + ["9", "add_count", 9] ] }, "insert": { @@ -501,16 +500,15 @@ ["space h", "select_references_to_symbol_under_cursor"], ["space c", "toggle_comment"], - ["0", "add_integer_argument_digit", 0], - ["1", "add_integer_argument_digit", 1], - ["2", "add_integer_argument_digit", 2], - ["3", "add_integer_argument_digit", 3], - ["4", "add_integer_argument_digit", 4], - ["5", "add_integer_argument_digit", 5], - ["6", "add_integer_argument_digit", 6], - ["7", "add_integer_argument_digit", 7], - ["8", "add_integer_argument_digit", 8], - ["9", "add_integer_argument_digit", 9] + ["1", "add_count", 1], + ["2", "add_count", 2], + ["3", "add_count", 3], + ["4", "add_count", 4], + ["5", "add_count", 5], + ["6", "add_count", 6], + ["7", "add_count", 7], + ["8", "add_count", 8], + ["9", "add_count", 9] ] }, "home": { diff --git a/src/keybind/builtin/vim.json b/src/keybind/builtin/vim.json index 21aa567..1733265 100644 --- a/src/keybind/builtin/vim.json +++ b/src/keybind/builtin/vim.json @@ -51,7 +51,7 @@ ["gd", "goto_definition"], ["gi", "goto_implementation"], ["gy", "goto_type_definition"], - ["gg", "goto_line_vim"], + ["gg", "move_buffer_begin"], ["grn", "rename_symbol"], ["gD", "goto_declaration"], ["G", "move_buffer_end"], diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 06564af..41e21be 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -5057,18 +5057,6 @@ pub const Editor = struct { } pub const goto_line_meta: Meta = .{ .arguments = &.{.integer} }; - pub fn goto_line_vim(self: *Self, ctx: Context) Result { - try self.send_editor_jump_source(); - var line: usize = 0; - _ = ctx.args.match(.{tp.extract(&line)}) catch false; - const root = self.buf_root() catch return; - const primary = self.get_primary(); - try primary.cursor.move_to(root, @intCast(if (line < 1) 0 else line - 1), primary.cursor.col, self.metrics); - self.clamp(); - try self.send_editor_jump_destination(); - } - pub const goto_line_vim_meta: Meta = .{ .arguments = &.{.integer} }; - pub fn goto_column(self: *Self, ctx: Context) Result { var column: usize = 0; if (!try ctx.args.match(.{tp.extract(&column)})) diff --git a/src/tui/mode/helix.zig b/src/tui/mode/helix.zig index bca1dfe..0343e97 100644 --- a/src/tui/mode/helix.zig +++ b/src/tui/mode/helix.zig @@ -78,29 +78,25 @@ const cmds_ = struct { } pub const save_selection_meta: Meta = .{ .description = "Save current selection to location history" }; - pub fn extend_line_below(_: *void, ctx: Ctx) Result { + pub fn extend_line_below(_: *void, _: Ctx) Result { const mv = tui.mainview() orelse return; const ed = mv.get_active_editor() orelse return; + const root = try ed.buf_root(); + for (ed.cursels.items) |*cursel_| if (cursel_.*) |*cursel| { + const sel = cursel.enable_selection_normal(); + sel.normalize(); - var repeat: usize = 1; - _ = ctx.args.match(.{tp.extract(&repeat)}) catch false; - while (repeat > 0) : (repeat -= 1) { - for (ed.cursels.items) |*cursel_| if (cursel_.*) |*cursel| { - const sel = cursel.enable_selection_normal(); - sel.normalize(); - - try Editor.move_cursor_begin(root, &sel.begin, ed.metrics); - try Editor.move_cursor_end(root, &sel.end, ed.metrics); - cursel.cursor = sel.end; - try cursel.selection.?.end.move_right(root, ed.metrics); - try cursel.cursor.move_right(root, ed.metrics); - }; - } + try Editor.move_cursor_begin(root, &sel.begin, ed.metrics); + try Editor.move_cursor_end(root, &sel.end, ed.metrics); + cursel.cursor = sel.end; + try cursel.selection.?.end.move_right(root, ed.metrics); + try cursel.cursor.move_right(root, ed.metrics); + }; ed.clamp(); } - pub const extend_line_below_meta: Meta = .{ .arguments = &.{.integer}, .description = "Select current line, if already selected, extend to next line" }; + pub const extend_line_below_meta: Meta = .{ .description = "Select current line, if already selected, extend to next line" }; pub fn move_next_word_start(_: *void, ctx: Ctx) Result { const mv = tui.mainview() orelse return;