diff --git a/src/keybind/builtin/flow.json b/src/keybind/builtin/flow.json index 2480b15..8d861e7 100644 --- a/src/keybind/builtin/flow.json +++ b/src/keybind/builtin/flow.json @@ -428,7 +428,7 @@ }, "mini/numeric": { "press": [ - ["b", "goto_offset"], + ["b", "toggle_goto_style"], ["ctrl+q", "quit"], ["ctrl+v", "system_paste"], ["ctrl+u", "mini_mode_reset"], diff --git a/src/tui/tui.zig b/src/tui/tui.zig index a465633..5d72e4b 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -1185,6 +1185,17 @@ const cmds = struct { .arguments = &.{.integer}, }; + pub fn toggle_goto_style(self: *Self, ctx: Ctx) Result { + return if (self.mini_mode_) |mode| + if (std.mem.eql(u8, mode.name, "#goto byte")) + command.executeName("goto", ctx) + else + command.executeName("goto_offset", ctx) + else + command.executeName("goto", ctx); + } + pub const toggle_goto_style_meta: Meta = .{ .description = "Toggle goto byte offset mode" }; + pub fn move_to_char(self: *Self, ctx: Ctx) Result { return enter_mini_mode(self, @import("mode/mini/move_to_char.zig"), ctx); }