From 23905902797c57b09acb358d9d982d67fb0a224b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20T=C3=A1mara?= Date: Thu, 25 Sep 2025 15:16:01 -0500 Subject: [PATCH] feat: add shorcuts for buffers in helix mode ## Added Behaviour for buffers :n create a new buffer - Uses language selection from flow <3 :bc close current buffer :bn next buffer :bp previous buffer :rl reload current buffer :qa! abandon without saving any buffer --- src/tui/mode/helix.zig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/tui/mode/helix.zig b/src/tui/mode/helix.zig index 7b093da..ef9ee40 100644 --- a/src/tui/mode/helix.zig +++ b/src/tui/mode/helix.zig @@ -45,6 +45,11 @@ const cmds_ = struct { } pub const @"q!_meta": Meta = .{ .description = "q! (quit without saving)" }; + pub fn @"qa!"(_: *void, _: Ctx) Result { + try cmd("quit_without_saving", .{}); + } + pub const @"qa!_meta": Meta = .{ .description = "qa! (quit without saving)" }; + pub fn wq(_: *void, _: Ctx) Result { try cmd("save_file", command.fmt(.{ "then", .{ "quit", .{} } })); } @@ -55,6 +60,11 @@ const cmds_ = struct { } pub const x_meta: Meta = .{ .description = "x (write/save file and quit)" }; + pub fn rl(_: *void, _: Ctx) Result { + try cmd("reload_file", .{}); + } + pub const rl_meta: Meta = .{ .description = "rl (force reload current file)" }; + pub fn o(_: *void, _: Ctx) Result { try cmd("open_file", .{}); } @@ -66,6 +76,26 @@ const cmds_ = struct { } pub const @"wq!_meta": Meta = .{ .description = "wq! (write/save file and quit without saving)" }; + pub fn n(_: *void, _: Ctx) Result { + try cmd("create_new_file", .{}); + } + pub const n_meta: Meta = .{ .description = "n (Create new buffer/tab)" }; + + pub fn bn(_: *void, _: Ctx) Result { + try cmd("next_tab", .{}); + } + pub const bn_meta: Meta = .{ .description = "bn (Next buffer/tab)" }; + + pub fn bp(_: *void, _: Ctx) Result { + try cmd("previous_tab", .{}); + } + pub const bp_meta: Meta = .{ .description = "bp (Previous buffer/tab)" }; + + pub fn bc(_: *void, _: Ctx) Result { + try cmd("delete_buffer", .{}); + } + pub const bc_meta: Meta = .{ .description = "bc (Close buffer/tab)" }; + pub fn save_selection(_: *void, _: Ctx) Result { const logger = log.logger("helix-mode"); defer logger.deinit();