feat(vim): Add word movement for visual mode, and complete vim mode cut to end of line

This commit is contained in:
lulvz 2025-02-12 21:38:27 +00:00
parent 4e4034d0f2
commit e443e8397b
2 changed files with 36 additions and 9 deletions

View file

@ -3536,6 +3536,13 @@ pub const Editor = struct {
}
pub const select_word_left_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 {
const root = try self.buf_root();
try self.with_selections_const(root, move_cursor_word_right);
@ -3543,6 +3550,20 @@ pub const Editor = struct {
}
pub const select_word_right_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 {
const root = try self.buf_root();
try self.with_selections_const(root, move_cursor_word_begin);