added * command in vim mode

This commit is contained in:
Robert Burnett 2025-05-12 12:26:36 -05:00 committed by CJ van den Berg
parent 7c51fa8400
commit acded15af8
2 changed files with 10 additions and 1 deletions

View file

@ -86,6 +86,7 @@
["<C-y>", "redo"],
["/", "find"],
["*", "find_word_at_cursor"],
["<C-k>", "TODO"],
@ -187,7 +188,7 @@
["mW", "set_global_mark", 87],
["mX", "set_global_mark", 88],
["mY", "set_global_mark", 89],
["mZ", "set_global_mark", 90]
["mZ", "set_global_mark", 90],
["'A", "goto_global_mark", 65],
["'B", "goto_global_mark", 66],

View file

@ -4772,6 +4772,14 @@ pub const Editor = struct {
}
pub const find_query_meta: Meta = .{ .arguments = &.{.string} };
pub fn find_word_at_cursor(self: *Self, ctx: Context) Result {
_ = ctx;
const query: []const u8 = try self.copy_word_at_cursor(self.allocator);
try self.find_in_buffer(query);
self.allocator.free(query);
}
pub const find_word_at_cursor_meta: Meta = .{ .description = "Search for the word under the cursor" };
fn find_in(self: *Self, query: []const u8, comptime find_f: ripgrep.FindF, write_buffer: bool) !void {
const root = try self.buf_root();
self.cancel_all_matches();