feat: load and edit key bindings in config directory
This commit is contained in:
parent
3af2b09891
commit
dc914ba562
5 changed files with 61 additions and 1 deletions
|
@ -40,6 +40,7 @@ pub fn create(allocator: std.mem.Allocator, parent: Widget) !Widget {
|
|||
try self.menu.add_item_with_handler("Open recent project ········ :r", menu_action_open_recent_project);
|
||||
try self.menu.add_item_with_handler("Show/Run commands ·········· :p", menu_action_show_commands);
|
||||
try self.menu.add_item_with_handler("Open config file ··········· :c", menu_action_open_config);
|
||||
try self.menu.add_item_with_handler("Open key bindings file ····· :k", menu_action_open_keybind_config);
|
||||
try self.menu.add_item_with_handler("Change theme ··············· :t", menu_action_change_theme);
|
||||
try self.menu.add_item_with_handler("Quit/Close ················· :q", menu_action_quit);
|
||||
self.menu.resize(.{ .y = 15, .x = 9, .w = 32 });
|
||||
|
@ -125,6 +126,10 @@ fn menu_action_open_config(_: **Menu.State(*Self), _: *Button.State(*Menu.State(
|
|||
command.executeName("open_config", .{}) catch {};
|
||||
}
|
||||
|
||||
fn menu_action_open_keybind_config(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
|
||||
command.executeName("open_keybind_config", .{}) catch {};
|
||||
}
|
||||
|
||||
fn menu_action_change_theme(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
|
||||
command.executeName("change_theme", .{}) catch {};
|
||||
}
|
||||
|
|
|
@ -807,6 +807,15 @@ const cmds = struct {
|
|||
self.mini_mode = null;
|
||||
}
|
||||
pub const exit_mini_mode_meta = .{ .interactive = false };
|
||||
|
||||
pub fn open_keybind_config(self: *Self, _: Ctx) Result {
|
||||
var mode_parts = std.mem.splitScalar(u8, self.config.input_mode, '/');
|
||||
const namespace_name = mode_parts.first();
|
||||
const file_name = try keybind.get_or_create_namespace_config_file(self.allocator, namespace_name);
|
||||
try tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_name } });
|
||||
self.logger.print("restart flow to use changed key bindings", .{});
|
||||
}
|
||||
pub const open_keybind_config_meta = .{ .description = "Edit key bindings" };
|
||||
};
|
||||
|
||||
pub const MiniMode = struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue