feat: [hx] r to replace with a character

If no selection, the character under the cursor is replaced, if
selection, each character is replaced by the typed character.
This commit is contained in:
Igor Támara 2025-10-29 00:51:18 -05:00 committed by CJ van den Berg
parent 411b26d4aa
commit 8246f2b0ba
4 changed files with 164 additions and 0 deletions

View file

@ -1167,6 +1167,11 @@ const cmds = struct {
}
pub const move_to_char_meta: Meta = .{ .description = "Move to character" };
pub fn replace(self: *Self, ctx: Ctx) Result {
return enter_mini_mode(self, @import("mode/mini/replace.zig"), ctx);
}
pub const replace_meta: Meta = .{ .description = "Replace with character" };
pub fn open_file(self: *Self, ctx: Ctx) Result {
if (get_active_selection(self.allocator)) |text| {
defer self.allocator.free(text);