goto_line_vim: integer parameters
This commit is contained in:
parent
f58babf2e7
commit
105be85d0f
3 changed files with 14 additions and 2 deletions
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
["v", "enter_mode", "select"],
|
["v", "enter_mode", "select"],
|
||||||
|
|
||||||
["g g", "move_buffer_begin"],
|
["g g", "goto_line_vim"],
|
||||||
["g e", "move_buffer_end"],
|
["g e", "move_buffer_end"],
|
||||||
["g f", "goto_file"],
|
["g f", "goto_file"],
|
||||||
["g h", "move_begin"],
|
["g h", "move_begin"],
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
["gd", "goto_definition"],
|
["gd", "goto_definition"],
|
||||||
["gi", "goto_implementation"],
|
["gi", "goto_implementation"],
|
||||||
["gy", "goto_type_definition"],
|
["gy", "goto_type_definition"],
|
||||||
["gg", "move_buffer_begin"],
|
["gg", "goto_line_vim"],
|
||||||
["grn", "rename_symbol"],
|
["grn", "rename_symbol"],
|
||||||
["gD", "goto_declaration"],
|
["gD", "goto_declaration"],
|
||||||
["G", "move_buffer_end"],
|
["G", "move_buffer_end"],
|
||||||
|
|
|
@ -5057,6 +5057,18 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const goto_line_meta: Meta = .{ .arguments = &.{.integer} };
|
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 {
|
pub fn goto_column(self: *Self, ctx: Context) Result {
|
||||||
var column: usize = 0;
|
var column: usize = 0;
|
||||||
if (!try ctx.args.match(.{tp.extract(&column)}))
|
if (!try ctx.args.match(.{tp.extract(&column)}))
|
||||||
|
|
Loading…
Add table
Reference in a new issue