normalize all paths

This commit is contained in:
Lucario387 2023-03-18 12:40:36 +09:00 committed by Sidhanth Rathod
parent 9dcaefd73f
commit 3563b5af83
1 changed files with 9 additions and 9 deletions

View File

@ -72,24 +72,24 @@ autocmd("FileType", {
}) })
-- reload some chadrc options on-save -- reload some chadrc options on-save
local sep = vim.loop.os_uname().sysname:find "windows" and "\\" or "/" local sep = is_windows and "\\" or "/"
vim.api.nvim_create_autocmd("BufWritePost", { vim.api.nvim_create_autocmd("BufWritePost", {
pattern = vim.fn.glob( pattern = vim.tbl_map(vim.fs.normalize, vim.fn.glob(
vim.fs.normalize(vim.fn.stdpath("config") .. "/lua/custom/**/*.lua"), vim.fn.stdpath("config") .. "/lua/custom/**/*.lua",
true, true,
true, true,
true true
), )),
group = vim.api.nvim_create_augroup("ReloadNvChad", {}), group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
callback = function(opts) 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("/", ".")
require("plenary.reload").reload_module "base46" require("plenary.reload").reload_module "base46"
local file = string require("plenary.reload").reload_module(module)
.gsub(vim.fn.fnamemodify(opts.file, ":r"), vim.fn.stdpath "config" .. sep .. "lua" .. sep, "")
:gsub(sep, ".")
require("plenary.reload").reload_module(file)
require("plenary.reload").reload_module "custom.chadrc" require("plenary.reload").reload_module "custom.chadrc"
config = require("core.utils").load_config() config = require("core.utils").load_config()