From c48196d1161fcd02ece5f69f9906d4af8b9ed729 Mon Sep 17 00:00:00 2001 From: Squibid Date: Sun, 15 Feb 2026 17:38:56 -0500 Subject: [PATCH] add init and deinit snippets for zig --- lua/snippets/zig.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/snippets/zig.lua b/lua/snippets/zig.lua index c0bc681..d7e244f 100644 --- a/lua/snippets/zig.lua +++ b/lua/snippets/zig.lua @@ -7,4 +7,18 @@ return { f(file_name, {}), t(" = @This();"), }), + + s("init", { + t("pub fn init() !*"), + f(file_name, {}), + t({ " {", "\tconst self = try gpa.create(" }), + f(file_name, {}), + t({ ");", "\tself.* = .{};", "\treturn self;", "}" }), + }), + + s("deinit", { + t("pub fn deinit(self: *"), + f(file_name, {}), + t({ ") void {", "\tgpa.destroy(self);", "}" }), + }), }