performance: avoid reloading config table #2360 (#2444)

* performance: avoid reloading config (#2360)

* performance: avoid reloading config

* Rm outdated info in readme

---------

Co-authored-by: Sidhanth Rathod <siduck@tutanota.com>

* update nvchad load_config result path

* update branch names

---------

Co-authored-by: georgejean <jeangeorge385@yahoo.fr>
This commit is contained in:
Sidhanth Rathod 2023-10-16 07:24:14 +05:30 committed by GitHub
parent ed18649e94
commit 5748536742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 14 deletions

View file

@ -18,7 +18,7 @@ M.lazy = function(install_path)
M.echo " Compiling base46 theme to bytecode ..."
local base46_repo = "https://github.com/NvChad/base46"
shell_call { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
shell_call { "git", "clone", "--depth", "1", "-b", "v3.0", base46_repo, lazy_path }
vim.opt.rtp:prepend(lazy_path)
require("base46").compile()

View file

@ -1,12 +1,9 @@
local opt = vim.opt
local g = vim.g
local config = require("core.utils").load_config()
-------------------------------------- globals -----------------------------------------
g.nvchad_theme = config.ui.theme
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
g.toggle_theme_icon = ""
g.transparency = config.ui.transparency
-------------------------------------- options ------------------------------------------
opt.laststatus = 3 -- global statusline
@ -83,11 +80,11 @@ autocmd("BufWritePost", {
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 "nvconfig"
require("plenary.reload").reload_module "base46"
require("plenary.reload").reload_module(module)
require("plenary.reload").reload_module "custom.chadrc"
config = require("core.utils").load_config()
local config = require "nvconfig"
vim.g.nvchad_theme = config.ui.theme
vim.g.transparency = config.ui.transparency

View file

@ -7,7 +7,7 @@ M.load_config = function()
if chadrc_path then
local chadrc = dofile(chadrc_path)
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
config = merge_tb("force", config, chadrc)
config.mappings.disabled = nil
@ -74,7 +74,7 @@ M.load_mappings = function(section, mapping_opt)
end
end
local mappings = require("core.utils").load_config().mappings
local mappings = require("nvconfig").mappings
if type(section) == "string" then
mappings[section]["plugin"] = nil