feat: add focus_split command
This commit is contained in:
parent
6502989fb8
commit
27bdd64f88
2 changed files with 18 additions and 1 deletions
|
|
@ -8,6 +8,10 @@
|
|||
["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"],
|
||||
|
|
@ -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"],
|
||||
|
|
|
|||
|
|
@ -782,6 +782,20 @@ const cmds = struct {
|
|||
}
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue