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"],
|
["alt+x", "open_command_palette"],
|
||||||
["f4", "toggle_input_mode"],
|
["f4", "toggle_input_mode"],
|
||||||
["ctrl+f2", "insert_command_name"],
|
["ctrl+f2", "insert_command_name"],
|
||||||
|
["ctrl+k ctrl+s", "insert_command_name"],
|
||||||
["f9", "theme_prev"],
|
["f9", "theme_prev"],
|
||||||
["f10", "theme_next"],
|
["f10", "theme_next"],
|
||||||
["f11", "toggle_panel"],
|
["f11", "toggle_panel"],
|
||||||
|
|
@ -168,8 +169,6 @@
|
||||||
["alt+}", "shrink_selection", true],
|
["alt+}", "shrink_selection", true],
|
||||||
["alt+[", "select_prev_sibling", true],
|
["alt+[", "select_prev_sibling", true],
|
||||||
["alt+]", "select_next_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+a", "select_all_siblings"],
|
||||||
["alt+shift+home", "move_scroll_left"],
|
["alt+shift+home", "move_scroll_left"],
|
||||||
["alt+shift+end", "move_scroll_right"],
|
["alt+shift+end", "move_scroll_right"],
|
||||||
|
|
@ -202,6 +201,7 @@
|
||||||
["shift+enter", "smart_insert_line_before"],
|
["shift+enter", "smart_insert_line_before"],
|
||||||
["shift+backspace", "delete_backward"],
|
["shift+backspace", "delete_backward"],
|
||||||
["ctrl+shift+k", "delete_line"],
|
["ctrl+shift+k", "delete_line"],
|
||||||
|
["alt+shift+e", "select_line"],
|
||||||
["shift+tab", "unindent"],
|
["shift+tab", "unindent"],
|
||||||
["f2", "rename_symbol"],
|
["f2", "rename_symbol"],
|
||||||
["f3", "goto_next_match"],
|
["f3", "goto_next_match"],
|
||||||
|
|
|
||||||
|
|
@ -3015,22 +3015,55 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const delete_to_end_meta: Meta = .{ .description = "Delete to end of line" };
|
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();
|
const b = try self.buf_for_update();
|
||||||
var root = b.root;
|
var root = b.root;
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
var repeat: usize = 1;
|
||||||
const col = cursel.cursor.col;
|
_ = ctx.args.match(.{tp.extract(&repeat)}) catch false;
|
||||||
const target = cursel.cursor.target;
|
while (repeat > 0) : (repeat -= 1) {
|
||||||
try self.select_line_at_cursor(root, cursel, .include_eol);
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
root = try self.delete_selection(root, cursel, b.allocator);
|
const col = cursel.cursor.col;
|
||||||
cursel.cursor.col = col;
|
const target = cursel.cursor.target;
|
||||||
cursel.cursor.target = target;
|
try self.select_line_at_cursor(root, cursel, .include_eol);
|
||||||
cursel.cursor.clamp_to_buffer(root, self.metrics);
|
root = try self.delete_selection(root, cursel, b.allocator);
|
||||||
};
|
cursel.cursor.col = col;
|
||||||
|
cursel.cursor.target = target;
|
||||||
|
cursel.cursor.clamp_to_buffer(root, self.metrics);
|
||||||
|
};
|
||||||
|
}
|
||||||
try self.update_buf(root);
|
try self.update_buf(root);
|
||||||
self.clamp();
|
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 {
|
pub fn cut_to_end_vim(self: *Self, _: Context) Result {
|
||||||
const b = try self.buf_for_update();
|
const b = try self.buf_for_update();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue