Compare commits
2 commits
024eb8b43b
...
f7496654ae
| Author | SHA1 | Date | |
|---|---|---|---|
| f7496654ae | |||
| be758be087 |
2 changed files with 29 additions and 2 deletions
|
|
@ -617,8 +617,10 @@ const cmds = struct {
|
||||||
|
|
||||||
pub fn delete_buffer(self: *Self, ctx: Ctx) Result {
|
pub fn delete_buffer(self: *Self, ctx: Ctx) Result {
|
||||||
var file_path: []const u8 = undefined;
|
var file_path: []const u8 = undefined;
|
||||||
if (!(ctx.args.match(.{tp.extract(&file_path)}) catch false))
|
if (!(ctx.args.match(.{tp.extract(&file_path)}) catch false)) {
|
||||||
return error.InvalidDeleteBufferArgument;
|
const editor = self.get_active_editor() orelse return error.InvalidDeleteBufferArgument;
|
||||||
|
file_path = editor.file_path orelse return error.InvalidDeleteBufferArgument;
|
||||||
|
}
|
||||||
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
|
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
|
||||||
if (buffer.is_dirty())
|
if (buffer.is_dirty())
|
||||||
return tp.exit("unsaved changes");
|
return tp.exit("unsaved changes");
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,31 @@ const cmds_ = struct {
|
||||||
}
|
}
|
||||||
pub const @"e!_meta": Meta = .{ .description = "e! (force reload current file)" };
|
pub const @"e!_meta": Meta = .{ .description = "e! (force reload current file)" };
|
||||||
|
|
||||||
|
pub fn bd(_: *void, _: Ctx) Result {
|
||||||
|
try cmd("close_file", .{});
|
||||||
|
}
|
||||||
|
pub const bd_meta: Meta = .{ .description = "bd (Close file)" };
|
||||||
|
|
||||||
|
pub fn bw(_: *void, _: Ctx) Result {
|
||||||
|
try cmd("delete_buffer", .{});
|
||||||
|
}
|
||||||
|
pub const bw_meta: Meta = .{ .description = "bw (Delete buffer)" };
|
||||||
|
|
||||||
|
pub fn bnext(_: *void, _: Ctx) Result {
|
||||||
|
try cmd("next_tab", .{});
|
||||||
|
}
|
||||||
|
pub const bnext_meta: Meta = .{ .description = "bnext (Next buffer/tab)" };
|
||||||
|
|
||||||
|
pub fn bprevious(_: *void, _: Ctx) Result {
|
||||||
|
try cmd("next_tab", .{});
|
||||||
|
}
|
||||||
|
pub const bprevious_meta: Meta = .{ .description = "bprevious (Previous buffer/tab)" };
|
||||||
|
|
||||||
|
pub fn ls(_: *void, _: Ctx) Result {
|
||||||
|
try cmd("switch_buffers", .{});
|
||||||
|
}
|
||||||
|
pub const ls_meta: Meta = .{ .description = "ls (List/switch buffers)" };
|
||||||
|
|
||||||
pub fn move_begin_or_add_integer_argument_zero(_: *void, _: Ctx) Result {
|
pub fn move_begin_or_add_integer_argument_zero(_: *void, _: Ctx) Result {
|
||||||
return if (@import("keybind").current_integer_argument()) |_|
|
return if (@import("keybind").current_integer_argument()) |_|
|
||||||
command.executeName("add_integer_argument_digit", command.fmt(.{0}))
|
command.executeName("add_integer_argument_digit", command.fmt(.{0}))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue