Compare commits
4 commits
fc8642768d
...
ec783d68a6
| Author | SHA1 | Date | |
|---|---|---|---|
| ec783d68a6 | |||
| eb11a40a9f | |||
| 70a793d942 | |||
| 21d1555aca |
2 changed files with 46 additions and 13 deletions
|
|
@ -25,6 +25,7 @@
|
|||
["alt+x", "open_command_palette"],
|
||||
["f4", "toggle_input_mode"],
|
||||
["ctrl+f2", "insert_command_name"],
|
||||
["ctrl+k ctrl+s", "insert_command_name"],
|
||||
["f9", "theme_prev"],
|
||||
["f10", "theme_next"],
|
||||
["f11", "toggle_panel"],
|
||||
|
|
@ -168,8 +169,6 @@
|
|||
["alt+}", "shrink_selection", true],
|
||||
["alt+[", "select_prev_sibling", true],
|
||||
["alt+]", "select_next_sibling", true],
|
||||
["alt+shift+e", "move_parent_node_end"],
|
||||
["alt+shift+b", "move_parent_node_start"],
|
||||
["alt+a", "select_all_siblings"],
|
||||
["alt+shift+home", "move_scroll_left"],
|
||||
["alt+shift+end", "move_scroll_right"],
|
||||
|
|
@ -202,6 +201,7 @@
|
|||
["shift+enter", "smart_insert_line_before"],
|
||||
["shift+backspace", "delete_backward"],
|
||||
["ctrl+shift+k", "delete_line"],
|
||||
["alt+shift+e", "select_line"],
|
||||
["shift+tab", "unindent"],
|
||||
["f2", "rename_symbol"],
|
||||
["f3", "goto_next_match"],
|
||||
|
|
|
|||
|
|
@ -3015,9 +3015,41 @@ pub const Editor = struct {
|
|||
}
|
||||
pub const delete_to_end_meta: Meta = .{ .description = "Delete to end of line" };
|
||||
|
||||
pub fn delete_line(self: *Self, _: Context) Result {
|
||||
pub fn select_line(self: *Self, ctx: Context) Result {
|
||||
const root = try self.buf_root();
|
||||
var repeat: usize = 1;
|
||||
_ = ctx.args.match(.{tp.extract(&repeat)}) catch false;
|
||||
while (repeat > 0) : (repeat -= 1) {
|
||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||
if (cursel.selection) |*sel| {
|
||||
sel.normalize();
|
||||
move_cursor_begin(root, &sel.begin, self.metrics) catch {};
|
||||
move_cursor_end(root, &sel.end, self.metrics) catch {};
|
||||
blk: {
|
||||
cursel.cursor.move_down(root, self.metrics) catch |e| switch (e) {
|
||||
error.Stop => {
|
||||
cursel.cursor.move_end(root, self.metrics);
|
||||
break :blk;
|
||||
},
|
||||
};
|
||||
move_cursor_begin(root, &cursel.cursor, self.metrics) catch {};
|
||||
}
|
||||
sel.end = cursel.cursor;
|
||||
} else {
|
||||
self.select_line_at_cursor(root, cursel, .include_eol) catch {};
|
||||
}
|
||||
};
|
||||
self.collapse_cursors();
|
||||
}
|
||||
}
|
||||
pub const select_line_meta: Meta = .{ .description = "Select current line", .arguments = &.{.integer} };
|
||||
|
||||
pub fn delete_line(self: *Self, ctx: Context) Result {
|
||||
const b = try self.buf_for_update();
|
||||
var root = b.root;
|
||||
var repeat: usize = 1;
|
||||
_ = ctx.args.match(.{tp.extract(&repeat)}) catch false;
|
||||
while (repeat > 0) : (repeat -= 1) {
|
||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||
const col = cursel.cursor.col;
|
||||
const target = cursel.cursor.target;
|
||||
|
|
@ -3027,10 +3059,11 @@ pub const Editor = struct {
|
|||
cursel.cursor.target = target;
|
||||
cursel.cursor.clamp_to_buffer(root, self.metrics);
|
||||
};
|
||||
}
|
||||
try self.update_buf(root);
|
||||
self.clamp();
|
||||
}
|
||||
pub const delete_line_meta: Meta = .{ .description = "Delete current line" };
|
||||
pub const delete_line_meta: Meta = .{ .description = "Delete current line", .arguments = &.{.integer} };
|
||||
|
||||
pub fn cut_to_end_vim(self: *Self, _: Context) Result {
|
||||
const b = try self.buf_for_update();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue