From 8214d4e8589aa6625c6db077b8eb199e7ebc1929 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Sat, 18 Mar 2023 14:14:42 +0900 Subject: [PATCH] fix NVIM_APPNAME --- lua/core/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index 7c88b5d..576c1cb 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -82,10 +82,9 @@ vim.api.nvim_create_autocmd("BufWritePost", { group = vim.api.nvim_create_augroup("ReloadNvChad", {}), callback = function(opts) - -- print("smadge") - local fp = vim.fn.fnamemodify(vim.fs.normalize(opts.file), ":r") --[[@as string]] - local app_name = vim.env.NVIM_APPNAME or "nvim" - local module = string.gsub(fp, ".*/" .. app_name .. "/lua/", ""):gsub("/", ".") + local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]] + local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim" + local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".") require("plenary.reload").reload_module "base46" require("plenary.reload").reload_module(module) require("plenary.reload").reload_module "custom.chadrc"