added cut_buffer_begin command and vim binding

This commit is contained in:
Robert Burnett 2025-05-11 20:44:09 -05:00 committed by CJ van den Berg
parent 43c77bb737
commit 28fdd95747
2 changed files with 10 additions and 0 deletions

View file

@ -61,6 +61,7 @@
["db", "cut_word_left_vim"],
["dd", "cut_internal_vim"],
["dG", "cut_buffer_end"],
["dgg", "cut_buffer_begin"],
["\"_dd", "delete_line"],
["cc", ["enter_mode", "insert"], ["cut_internal_vim"]],

View file

@ -2970,6 +2970,15 @@ pub const Editor = struct {
}
pub const cut_buffer_end_meta: Meta = .{ .description = "Cut to the end of the buffer (copies cut text into clipboard)" };
pub fn cut_buffer_begin(self: *Self, _: Context) Result {
const b = try self.buf_for_update();
const text, const root = try self.cut_to(move_cursor_buffer_begin, b.root);
self.set_clipboard_internal(text);
try self.update_buf(root);
self.clamp();
}
pub const cut_buffer_begin_meta: Meta = .{ .description = "Cut to the beginning of the buffer (copies cut text into clipboard)" };
pub fn cut_word_left_vim(self: *Self, _: Context) Result {
const b = try self.buf_for_update();
const text, const root = try self.cut_to(move_cursor_word_left_vim, b.root);