Skip to content

Instantly share code, notes, and snippets.

@nothke
Created September 21, 2023 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothke/a20d8a286450687ff10a5a3c01546632 to your computer and use it in GitHub Desktop.
Save nothke/a20d8a286450687ff10a5a3c01546632 to your computer and use it in GitHub Desktop.
My zig snippets for VS Code
{
"Self": {
"prefix": "self",
"body": "const Self = @This();",
},
"Scoped function": {
"prefix": "fnself",
"body": "fn ${1:MyScopedFunction}(self: Self) ${2:void} {$0}",
},
"Mutable scoped function": {
"prefix": "fnselfmut",
"body": [
"fn ${1:MyScopedFunction}(self: *Self) void {",
" self.*.$0;",
"}"
],
},
"Function pointer": {
"prefix": "fnptr",
"body": "*const fn (${1:args}) ${2:ReturnType}",
},
"General purpose allocator": {
"prefix" : "gpa",
"body": [
"var gpa = std.heap.GeneralPurposeAllocator(.{}){};",
"defer _ = gpa.deinit();",
"const alloc = gpa.allocator();",
]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment