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
This commit is contained in:
Igor Támara 2025-09-25 15:16:01 -05:00 committed by CJ van den Berg
parent 21384b7a5f
commit 2390590279

View file

@ -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();