Compare commits
No commits in common. "64ccbd3c1426aebc8e7d187f8f69e268a1b7d209" and "5fc2247bc3e81eb6b2917b793a951141aeaac505" have entirely different histories.
64ccbd3c14
...
5fc2247bc3
2 changed files with 11 additions and 203 deletions
|
@ -20,8 +20,8 @@
|
||||||
["s", ["cut_forward_internal"], ["enter_mode", "insert"]],
|
["s", ["cut_forward_internal"], ["enter_mode", "insert"]],
|
||||||
["u", "undo"],
|
["u", "undo"],
|
||||||
|
|
||||||
["j", "move_down_vim"],
|
["j", "move_down"],
|
||||||
["k", "move_up_vim"],
|
["k", "move_up"],
|
||||||
["l", "move_right_vim"],
|
["l", "move_right_vim"],
|
||||||
["h", "move_left_vim"],
|
["h", "move_left_vim"],
|
||||||
["<Space>", "move_right_vim"],
|
["<Space>", "move_right_vim"],
|
||||||
|
@ -33,20 +33,15 @@
|
||||||
["o", ["smart_insert_line_after"], ["enter_mode", "insert"]],
|
["o", ["smart_insert_line_after"], ["enter_mode", "insert"]],
|
||||||
["O", ["smart_insert_line_before"], ["enter_mode", "insert"]],
|
["O", ["smart_insert_line_before"], ["enter_mode", "insert"]],
|
||||||
|
|
||||||
["<S-.><S-.>", "indent"],
|
|
||||||
["<S-,><S-,>", "unindent"],
|
|
||||||
|
|
||||||
["v", "enter_mode", "visual"],
|
["v", "enter_mode", "visual"],
|
||||||
["V", ["enter_mode", "visual line"], ["select_line_vim"]],
|
["V", ["move_begin"], ["enter_mode", "visual"], ["select_end"]],
|
||||||
|
|
||||||
["n", "goto_next_match"],
|
["n", "goto_next_match"],
|
||||||
["0", "move_begin"],
|
["0", "move_begin"],
|
||||||
["^", "smart_move_begin"],
|
["^", "smart_move_begin"],
|
||||||
["$", "move_end"],
|
["$", "move_end"],
|
||||||
[":", "open_command_palette"],
|
[":", "open_command_palette"],
|
||||||
|
|
||||||
["p", "paste_internal_vim"],
|
["p", "paste_internal_vim"],
|
||||||
["P", "paste_internal_vim"],
|
|
||||||
|
|
||||||
["gd", "goto_definition"],
|
["gd", "goto_definition"],
|
||||||
["gi", "goto_implementation"],
|
["gi", "goto_implementation"],
|
||||||
|
@ -56,25 +51,16 @@
|
||||||
["gD", "goto_declaration"],
|
["gD", "goto_declaration"],
|
||||||
["G", "move_buffer_end"],
|
["G", "move_buffer_end"],
|
||||||
|
|
||||||
["d$", "cut_to_end_vim"],
|
["d$", "delete_to_end"],
|
||||||
["dw", "cut_word_right_vim"],
|
["dw", "cut_word_right_vim"],
|
||||||
["db", "cut_word_left_vim"],
|
["db", "cut_word_left_vim"],
|
||||||
["dd", "cut_internal_vim"],
|
["dd", "cut_internal_vim"],
|
||||||
["\"_dd", "delete_line"],
|
["\"_dd", "delete_line"],
|
||||||
|
|
||||||
["cc", ["cut_internal_vim"], ["enter_mode", "insert"]],
|
|
||||||
["C", ["cut_to_end_vim"], ["enter_mode", "insert"]],
|
|
||||||
["D", "cut_to_end_vim"],
|
|
||||||
["cw", ["cut_word_right_vim"], ["enter_mode", "insert"]],
|
|
||||||
["cb", ["cut_word_left_vim"], ["enter_mode", "insert"]],
|
|
||||||
|
|
||||||
["yy", ["copy_line_internal_vim"], ["cancel"]],
|
["yy", ["copy_line_internal_vim"], ["cancel"]],
|
||||||
|
|
||||||
["<C-u>", "move_scroll_half_page_up_vim"],
|
["<C-u>", "move_scroll_page_up"],
|
||||||
["<C-d>", "move_scroll_half_page_down_vim"],
|
["<C-d>", "move_scroll_page_down"],
|
||||||
|
|
||||||
["zz", "scroll_view_center"],
|
|
||||||
|
|
||||||
["u", "undo"],
|
["u", "undo"],
|
||||||
["<C-r>", "redo"],
|
["<C-r>", "redo"],
|
||||||
["<C-o>", "jump_back"],
|
["<C-o>", "jump_back"],
|
||||||
|
@ -97,77 +83,17 @@
|
||||||
"cursor": "block",
|
"cursor": "block",
|
||||||
"selection": "normal",
|
"selection": "normal",
|
||||||
"press": [
|
"press": [
|
||||||
["<Esc>", ["cancel"], ["enter_mode", "normal"]],
|
["<Esc>", "enter_mode", "normal"],
|
||||||
["k", "select_up"],
|
["k", "select_up"],
|
||||||
["j", "select_down"],
|
["j", "select_down"],
|
||||||
["h", "select_left"],
|
["h", "select_left"],
|
||||||
["l", "select_right"],
|
["l", "select_right"],
|
||||||
|
|
||||||
["b", "select_word_left_vim"],
|
|
||||||
["w", "select_word_right_vim"],
|
|
||||||
["W", "select_word_right"],
|
|
||||||
["B", "select_word_left"],
|
|
||||||
["e", "select_word_right_end_vim"],
|
|
||||||
|
|
||||||
["0", "move_begin"],
|
|
||||||
["^", "smart_move_begin"],
|
|
||||||
["$", "move_end"],
|
|
||||||
|
|
||||||
["p", ["paste_internal_vim"], ["enter_mode", "normal"]],
|
|
||||||
["P", ["paste_internal_vim"], ["enter_mode", "normal"]],
|
|
||||||
|
|
||||||
["<C-u>", "move_scroll_half_page_up_vim"],
|
|
||||||
["<C-d>", "move_scroll_half_page_down_vim"],
|
|
||||||
|
|
||||||
["zz", "scroll_view_center"],
|
|
||||||
["<S-.>", "indent"],
|
|
||||||
["<S-,>", "unindent"],
|
|
||||||
|
|
||||||
["y", ["copy_internal_vim"], ["cancel"], ["enter_mode", "normal"]],
|
["y", ["copy_internal_vim"], ["cancel"], ["enter_mode", "normal"]],
|
||||||
|
|
||||||
["x", ["cut_forward_internal"], ["enter_mode", "normal"]],
|
["x", ["cut_forward_internal"], ["cancel"], ["enter_mode", "normal"]],
|
||||||
["d", ["cut_forward_internal"], ["enter_mode", "normal"]],
|
["d", ["cut_forward_internal"], ["cancel"], ["enter_mode", "normal"]],
|
||||||
["s", ["cut_forward_internal"], ["enter_mode", "insert"]],
|
["s", ["cut_forward_internal"], ["cancel"], ["enter_mode", "insert"]]
|
||||||
|
|
||||||
["c", ["cut_forward_internal"], ["enter_mode", "insert"]],
|
|
||||||
["C", ["cut_to_end_vim"], ["enter_mode", "insert"]],
|
|
||||||
["D", "cut_to_end_vim"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"visual line": {
|
|
||||||
"syntax": "vim",
|
|
||||||
"on_match_failure": "ignore",
|
|
||||||
"name": "VISUAL LINE",
|
|
||||||
"line_numbers": "relative",
|
|
||||||
"cursor": "block",
|
|
||||||
"selection": "normal",
|
|
||||||
"press": [
|
|
||||||
["<Esc>", ["cancel"], ["enter_mode", "normal"]],
|
|
||||||
["k", "select_up"],
|
|
||||||
["j", "select_down"],
|
|
||||||
|
|
||||||
["0", "move_begin"],
|
|
||||||
["^", "smart_move_begin"],
|
|
||||||
["$", "move_end"],
|
|
||||||
|
|
||||||
["p", ["paste_internal_vim"], ["enter_mode", "normal"]],
|
|
||||||
["P", ["paste_internal_vim"], ["enter_mode", "normal"]],
|
|
||||||
|
|
||||||
["<C-u>", "move_scroll_half_page_up_vim"],
|
|
||||||
["<C-d>", "move_scroll_half_page_down_vim"],
|
|
||||||
|
|
||||||
["<S-.>", "indent"],
|
|
||||||
["<S-,>", "unindent"],
|
|
||||||
|
|
||||||
["y", ["copy_line_internal_vim"], ["cancel"], ["enter_mode", "normal"]],
|
|
||||||
|
|
||||||
["x", ["cut_internal_vim"], ["enter_mode", "normal"]],
|
|
||||||
["d", ["cut_internal_vim"], ["enter_mode", "normal"]],
|
|
||||||
["s", ["cut_internal_vim"], ["enter_mode", "insert"]],
|
|
||||||
|
|
||||||
["c", ["cut_internal_vim"], ["enter_mode", "insert"]],
|
|
||||||
["C", ["cut_to_end_vim"], ["enter_mode", "insert"]],
|
|
||||||
["D", "cut_to_end_vim"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"insert": {
|
"insert": {
|
||||||
|
@ -176,7 +102,7 @@
|
||||||
"line_numbers": "absolute",
|
"line_numbers": "absolute",
|
||||||
"cursor": "beam",
|
"cursor": "beam",
|
||||||
"press": [
|
"press": [
|
||||||
["<Esc>", ["move_left_vim"], ["enter_mode", "normal"]],
|
["<Esc>", "enter_mode", "normal"],
|
||||||
["<Del>", "delete_forward"],
|
["<Del>", "delete_forward"],
|
||||||
["<BS>", "delete_backward"],
|
["<BS>", "delete_backward"],
|
||||||
["<CR>", "smart_insert_line"],
|
["<CR>", "smart_insert_line"],
|
||||||
|
|
|
@ -2030,14 +2030,6 @@ pub const Editor = struct {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_eol_vim(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
|
|
||||||
const line_width = root.line_width(cursor.row, metrics) catch return true;
|
|
||||||
if (line_width == 0) return true;
|
|
||||||
if (cursor.col >= line_width)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn move_cursor_left(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void {
|
fn move_cursor_left(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) error{Stop}!void {
|
||||||
try cursor.move_left(root, metrics);
|
try cursor.move_left(root, metrics);
|
||||||
}
|
}
|
||||||
|
@ -2079,28 +2071,14 @@ pub const Editor = struct {
|
||||||
cursor.move_end(root, metrics);
|
cursor.move_end(root, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_cursor_end_vim(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
|
||||||
move_cursor_right_until(root, cursor, is_eol_vim, metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn move_cursor_up(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
fn move_cursor_up(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
||||||
try cursor.move_up(root, metrics);
|
try cursor.move_up(root, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_cursor_up_vim(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
|
||||||
try cursor.move_up(root, metrics);
|
|
||||||
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn move_cursor_down(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
fn move_cursor_down(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
||||||
try cursor.move_down(root, metrics);
|
try cursor.move_down(root, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_cursor_down_vim(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
|
|
||||||
try cursor.move_down(root, metrics);
|
|
||||||
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn move_cursor_buffer_begin(_: Buffer.Root, cursor: *Cursor, _: Buffer.Metrics) !void {
|
fn move_cursor_buffer_begin(_: Buffer.Root, cursor: *Cursor, _: Buffer.Metrics) !void {
|
||||||
cursor.move_buffer_begin();
|
cursor.move_buffer_begin();
|
||||||
}
|
}
|
||||||
|
@ -2121,20 +2099,10 @@ pub const Editor = struct {
|
||||||
cursor.move_half_page_up(root, view, metrics);
|
cursor.move_half_page_up(root, view, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_cursor_half_page_up_vim(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
|
|
||||||
cursor.move_half_page_up(root, view, metrics);
|
|
||||||
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn move_cursor_half_page_down(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
|
fn move_cursor_half_page_down(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
|
||||||
cursor.move_half_page_down(root, view, metrics);
|
cursor.move_half_page_down(root, view, metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_cursor_half_page_down_vim(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
|
|
||||||
cursor.move_half_page_down(root, view, metrics);
|
|
||||||
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn primary_click(self: *Self, y: c_int, x: c_int) !void {
|
pub fn primary_click(self: *Self, y: c_int, x: c_int) !void {
|
||||||
const root = self.buf_root() catch return;
|
const root = self.buf_root() catch return;
|
||||||
if (self.fast_scroll) {
|
if (self.fast_scroll) {
|
||||||
|
@ -2771,15 +2739,6 @@ 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 cut_to_end_vim(self: *Self, _: Context) Result {
|
|
||||||
const b = try self.buf_for_update();
|
|
||||||
const text, const root = try self.cut_to(move_cursor_end_vim, b.root);
|
|
||||||
self.set_clipboard_internal(text);
|
|
||||||
try self.update_buf(root);
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const cut_to_end_vim_meta = .{ .description = "Cut to end of line (vim)" };
|
|
||||||
|
|
||||||
pub fn join_next_line(self: *Self, _: Context) Result {
|
pub fn join_next_line(self: *Self, _: Context) Result {
|
||||||
const b = try self.buf_for_update();
|
const b = try self.buf_for_update();
|
||||||
try self.with_cursors_const(b.root, move_cursor_end);
|
try self.with_cursors_const(b.root, move_cursor_end);
|
||||||
|
@ -2980,13 +2939,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const move_up_meta: Meta = .{ .description = "Move cursor up" };
|
pub const move_up_meta: Meta = .{ .description = "Move cursor up" };
|
||||||
|
|
||||||
pub fn move_up_vim(self: *Self, _: Context) Result {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
self.with_cursors_const(root, move_cursor_up_vim) catch {};
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const move_up_vim_meta = .{ .description = "Move cursor up (vim)" };
|
|
||||||
|
|
||||||
pub fn add_cursor_up(self: *Self, _: Context) Result {
|
pub fn add_cursor_up(self: *Self, _: Context) Result {
|
||||||
try self.push_cursor();
|
try self.push_cursor();
|
||||||
const primary = self.get_primary();
|
const primary = self.get_primary();
|
||||||
|
@ -3003,13 +2955,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const move_down_meta: Meta = .{ .description = "Move cursor down" };
|
pub const move_down_meta: Meta = .{ .description = "Move cursor down" };
|
||||||
|
|
||||||
pub fn move_down_vim(self: *Self, _: Context) Result {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
self.with_cursors_const(root, move_cursor_down_vim) catch {};
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const move_down_vim_meta = .{ .description = "Move cursor down (vim)" };
|
|
||||||
|
|
||||||
pub fn add_cursor_down(self: *Self, _: Context) Result {
|
pub fn add_cursor_down(self: *Self, _: Context) Result {
|
||||||
try self.push_cursor();
|
try self.push_cursor();
|
||||||
const primary = self.get_primary();
|
const primary = self.get_primary();
|
||||||
|
@ -3360,18 +3305,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const move_scroll_half_page_up_meta: Meta = .{ .description = "Move and scroll half a page up" };
|
pub const move_scroll_half_page_up_meta: Meta = .{ .description = "Move and scroll half a page up" };
|
||||||
|
|
||||||
pub fn move_scroll_half_page_up_vim(self: *Self, _: Context) Result {
|
|
||||||
if (self.screen_cursor(&self.get_primary().cursor)) |cursor| {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
self.with_cursors_and_view_const(root, move_cursor_half_page_up_vim, &self.view) catch {};
|
|
||||||
const new_cursor_row = self.get_primary().cursor.row;
|
|
||||||
self.update_scroll_dest_abs(if (cursor.row > new_cursor_row) 0 else new_cursor_row - cursor.row);
|
|
||||||
} else {
|
|
||||||
return self.move_half_page_up(.{});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub const move_scroll_half_page_up_vim_meta = .{ .description = "Move and scroll half a page up (vim)" };
|
|
||||||
|
|
||||||
pub fn move_scroll_half_page_down(self: *Self, _: Context) Result {
|
pub fn move_scroll_half_page_down(self: *Self, _: Context) Result {
|
||||||
if (self.screen_cursor(&self.get_primary().cursor)) |cursor| {
|
if (self.screen_cursor(&self.get_primary().cursor)) |cursor| {
|
||||||
const root = try self.buf_root();
|
const root = try self.buf_root();
|
||||||
|
@ -3384,18 +3317,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const move_scroll_half_page_down_meta: Meta = .{ .description = "Move and scroll half a page down" };
|
pub const move_scroll_half_page_down_meta: Meta = .{ .description = "Move and scroll half a page down" };
|
||||||
|
|
||||||
pub fn move_scroll_half_page_down_vim(self: *Self, _: Context) Result {
|
|
||||||
if (self.screen_cursor(&self.get_primary().cursor)) |cursor| {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
self.with_cursors_and_view_const(root, move_cursor_half_page_down_vim, &self.view) catch {};
|
|
||||||
const new_cursor_row = self.get_primary().cursor.row;
|
|
||||||
self.update_scroll_dest_abs(if (cursor.row > new_cursor_row) 0 else new_cursor_row - cursor.row);
|
|
||||||
} else {
|
|
||||||
return self.move_half_page_down(.{});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub const move_scroll_half_page_down_vim_meta = .{ .description = "Move and scroll half a page down (vim)" };
|
|
||||||
|
|
||||||
pub fn smart_move_begin(self: *Self, _: Context) Result {
|
pub fn smart_move_begin(self: *Self, _: Context) Result {
|
||||||
const root = try self.buf_root();
|
const root = try self.buf_root();
|
||||||
try self.with_cursors_const(root, smart_move_cursor_begin);
|
try self.with_cursors_const(root, smart_move_cursor_begin);
|
||||||
|
@ -3476,16 +3397,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const cancel_meta: Meta = .{ .description = "Cancel current action" };
|
pub const cancel_meta: Meta = .{ .description = "Cancel current action" };
|
||||||
|
|
||||||
pub fn select_line_vim(self: *Self, _: Context) Result {
|
|
||||||
self.selection_mode = .line;
|
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel|
|
|
||||||
try self.select_line_around_cursor(cursel);
|
|
||||||
self.collapse_cursors();
|
|
||||||
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const select_line_vim_meta = .{ .description = "Select the line around the cursor (vim)" };
|
|
||||||
|
|
||||||
pub fn select_up(self: *Self, _: Context) Result {
|
pub fn select_up(self: *Self, _: Context) Result {
|
||||||
const root = try self.buf_root();
|
const root = try self.buf_root();
|
||||||
try self.with_selections_const(root, move_cursor_up);
|
try self.with_selections_const(root, move_cursor_up);
|
||||||
|
@ -3537,13 +3448,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const select_word_left_meta: Meta = .{ .description = "Select left by word" };
|
pub const select_word_left_meta: Meta = .{ .description = "Select left by word" };
|
||||||
|
|
||||||
pub fn select_word_left_vim(self: *Self, _: Context) Result {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
try self.with_selections_const(root, move_cursor_word_left_vim);
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const select_word_left_vim_meta = .{ .description = "Select left by word (vim)" };
|
|
||||||
|
|
||||||
pub fn select_word_right(self: *Self, _: Context) Result {
|
pub fn select_word_right(self: *Self, _: Context) Result {
|
||||||
const root = try self.buf_root();
|
const root = try self.buf_root();
|
||||||
try self.with_selections_const(root, move_cursor_word_right);
|
try self.with_selections_const(root, move_cursor_word_right);
|
||||||
|
@ -3551,20 +3455,6 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const select_word_right_meta: Meta = .{ .description = "Select right by word" };
|
pub const select_word_right_meta: Meta = .{ .description = "Select right by word" };
|
||||||
|
|
||||||
pub fn select_word_right_vim(self: *Self, _: Context) Result {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
try self.with_selections_const(root, move_cursor_word_right_vim);
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const select_word_right_vim_meta = .{ .description = "Select right by word (vim)" };
|
|
||||||
|
|
||||||
pub fn select_word_right_end_vim(self: *Self, _: Context) Result {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
try self.with_selections_const(root, move_cursor_word_right_end_vim);
|
|
||||||
self.clamp();
|
|
||||||
}
|
|
||||||
pub const select_word_right_end_vim_meta = .{ .description = "Select right by end of word (vim)" };
|
|
||||||
|
|
||||||
pub fn select_word_begin(self: *Self, _: Context) Result {
|
pub fn select_word_begin(self: *Self, _: Context) Result {
|
||||||
const root = try self.buf_root();
|
const root = try self.buf_root();
|
||||||
try self.with_selections_const(root, move_cursor_word_begin);
|
try self.with_selections_const(root, move_cursor_word_begin);
|
||||||
|
@ -3701,14 +3591,6 @@ pub const Editor = struct {
|
||||||
cursel.cursor = sel.end;
|
cursel.cursor = sel.end;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_line_around_cursor(self: *Self, cursel: *CurSel) !void {
|
|
||||||
const root = try self.buf_root();
|
|
||||||
const sel = try cursel.enable_selection(root, self.metrics);
|
|
||||||
sel.normalize();
|
|
||||||
try move_cursor_begin(root, &sel.begin, self.metrics);
|
|
||||||
try move_cursor_end(root, &sel.end, self.metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn selection_reverse(_: Buffer.Root, cursel: *CurSel) !void {
|
fn selection_reverse(_: Buffer.Root, cursel: *CurSel) !void {
|
||||||
if (cursel.selection) |*sel| {
|
if (cursel.selection) |*sel| {
|
||||||
sel.reverse();
|
sel.reverse();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue