From 4c4139709a8d2c1bb1030924eb7e61b21006ba4a Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Mon, 21 Nov 2022 00:24:12 +0100 Subject: [PATCH] upadte mzte-nv --- mzte-nv/conf/lua/pluginconf/nvimtree.lua | 5 +++++ mzte-nv/src/compiler.zig | 9 +++------ mzte-nv/src/modules/compile.zig | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mzte-nv/conf/lua/pluginconf/nvimtree.lua b/mzte-nv/conf/lua/pluginconf/nvimtree.lua index ce540fd..4547816 100644 --- a/mzte-nv/conf/lua/pluginconf/nvimtree.lua +++ b/mzte-nv/conf/lua/pluginconf/nvimtree.lua @@ -3,6 +3,11 @@ local map = vim.api.nvim_set_keymap require("nvim-tree").setup { open_on_setup = not vim.g.started_by_vinput, open_on_setup_file = false, + actions = { + change_dir = { + global = true, + }, + }, view = { adaptive_size = true, }, diff --git a/mzte-nv/src/compiler.zig b/mzte-nv/src/compiler.zig index f4a1566..fb6c981 100644 --- a/mzte-nv/src/compiler.zig +++ b/mzte-nv/src/compiler.zig @@ -20,15 +20,12 @@ pub fn main() !void { const input_arg = std.mem.span(std.os.argv[1]); - try doCompile(input_arg); -} - -pub fn doCompile(path: []const u8) !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); + try doCompile(input_arg, gpa.allocator()); +} - const alloc = gpa.allocator(); - +pub fn doCompile(path: []const u8, alloc: std.mem.Allocator) !void { var dir = try std.fs.cwd().openIterableDir(path, .{}); defer dir.close(); diff --git a/mzte-nv/src/modules/compile.zig b/mzte-nv/src/modules/compile.zig index 7c32cca..f32dd15 100644 --- a/mzte-nv/src/modules/compile.zig +++ b/mzte-nv/src/modules/compile.zig @@ -14,6 +14,6 @@ pub fn luaPush(l: *c.lua_State) void { fn lCompilePath(l: *c.lua_State) !c_int { const path = c.luaL_checklstring(l, 1, null); - try compiler.doCompile(std.mem.span(path)); + try compiler.doCompile(std.mem.span(path), std.heap.c_allocator); return 0; }