Compare commits

...

2 commits

2 changed files with 21 additions and 2 deletions

View file

@ -8,9 +8,13 @@
["f1", "open_help"],
["ctrl+\\", "add_split"],
["ctrl+k w", "close_split"],
["ctrl+1", "focus_split", 0],
["ctrl+2", "focus_split", 1],
["ctrl+3", "focus_split", 2],
["ctrl+4", "focus_split", 3],
["ctrl+j", "toggle_panel"],
["ctrl+q", "quit"],
["ctrl+w", "quit"],
["ctrl+w", "close_split"],
["ctrl+o", "open_file"],
["ctrl+e", "open_recent"],
["alt+o", "open_previous_file"],
@ -36,7 +40,6 @@
["alt+f11", "toggle_color_scheme"],
["f12", "toggle_inputview"],
["alt+!", "run_task"],
["ctrl+1", "add_task"],
["ctrl+tab", "next_tab"],
["ctrl+shift+g", "show_vcs_status"],
["ctrl+shift+tab", "previous_tab"],

View file

@ -778,10 +778,26 @@ const cmds = struct {
pub const add_split_meta: Meta = .{ .description = "Add split view" };
pub fn close_split(self: *Self, _: Ctx) Result {
if (self.views.widgets.items.len == 1)
return command.executeName("quit", .{});
return self.remove_active_view();
}
pub const close_split_meta: Meta = .{ .description = "Close split view" };
pub fn focus_split(self: *Self, ctx: Ctx) Result {
var n: usize = undefined;
if (!try ctx.args.match(.{tp.extract(&n)})) return error.InvalidFocusSplitArgument;
if (n > self.views.widgets.items.len) return;
if (n == self.views.widgets.items.len)
return self.create_home_split();
if (self.views.get_at(self.active_view)) |view| view.unfocus();
self.active_view = n;
if (self.views.get_at(self.active_view)) |view| view.focus();
}
pub const focus_split_meta: Meta = .{ .description = "Focus split view", .arguments = &.{.integer} };
pub fn gutter_mode_next(self: *Self, _: Ctx) Result {
const config = tui.config_mut();
const mode: ?@import("config").LineNumberMode = if (config.gutter_line_numbers_mode) |mode| switch (mode) {