Compare commits
3 commits
33d4eb044a
...
105be85d0f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
105be85d0f | ||
![]() |
f58babf2e7 | ||
![]() |
e993296590 |
4 changed files with 50 additions and 32 deletions
|
@ -120,7 +120,7 @@
|
|||
|
||||
["v", "enter_mode", "select"],
|
||||
|
||||
["g g", "move_buffer_begin"],
|
||||
["g g", "goto_line_vim"],
|
||||
["g e", "move_buffer_end"],
|
||||
["g f", "goto_file"],
|
||||
["g h", "move_begin"],
|
||||
|
@ -225,15 +225,16 @@
|
|||
["space h", "select_references_to_symbol_under_cursor"],
|
||||
["space c", "toggle_comment"],
|
||||
|
||||
["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]
|
||||
["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]
|
||||
]
|
||||
},
|
||||
"insert": {
|
||||
|
@ -500,15 +501,16 @@
|
|||
["space h", "select_references_to_symbol_under_cursor"],
|
||||
["space c", "toggle_comment"],
|
||||
|
||||
["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]
|
||||
["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]
|
||||
]
|
||||
},
|
||||
"home": {
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
["gd", "goto_definition"],
|
||||
["gi", "goto_implementation"],
|
||||
["gy", "goto_type_definition"],
|
||||
["gg", "move_buffer_begin"],
|
||||
["gg", "goto_line_vim"],
|
||||
["grn", "rename_symbol"],
|
||||
["gD", "goto_declaration"],
|
||||
["G", "move_buffer_end"],
|
||||
|
|
|
@ -5057,6 +5057,18 @@ 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)}))
|
||||
|
|
|
@ -78,25 +78,29 @@ const cmds_ = struct {
|
|||
}
|
||||
pub const save_selection_meta: Meta = .{ .description = "Save current selection to location history" };
|
||||
|
||||
pub fn extend_line_below(_: *void, _: Ctx) Result {
|
||||
pub fn extend_line_below(_: *void, ctx: 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();
|
||||
|
||||
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);
|
||||
};
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
ed.clamp();
|
||||
}
|
||||
pub const extend_line_below_meta: Meta = .{ .description = "Select current line, if already selected, extend to next line" };
|
||||
pub const extend_line_below_meta: Meta = .{ .arguments = &.{.integer}, .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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue