* 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:
parent
ed18649e94
commit
5748536742
|
@ -18,7 +18,7 @@ M.lazy = function(install_path)
|
||||||
M.echo " Compiling base46 theme to bytecode ..."
|
M.echo " Compiling base46 theme to bytecode ..."
|
||||||
|
|
||||||
local base46_repo = "https://github.com/NvChad/base46"
|
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)
|
vim.opt.rtp:prepend(lazy_path)
|
||||||
|
|
||||||
require("base46").compile()
|
require("base46").compile()
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
local config = require("core.utils").load_config()
|
|
||||||
|
|
||||||
-------------------------------------- globals -----------------------------------------
|
-------------------------------------- globals -----------------------------------------
|
||||||
g.nvchad_theme = config.ui.theme
|
|
||||||
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
||||||
g.toggle_theme_icon = " "
|
g.toggle_theme_icon = " "
|
||||||
g.transparency = config.ui.transparency
|
|
||||||
|
|
||||||
-------------------------------------- options ------------------------------------------
|
-------------------------------------- options ------------------------------------------
|
||||||
opt.laststatus = 3 -- global statusline
|
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 app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim"
|
||||||
local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".")
|
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 "base46"
|
||||||
require("plenary.reload").reload_module(module)
|
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.nvchad_theme = config.ui.theme
|
||||||
vim.g.transparency = config.ui.transparency
|
vim.g.transparency = config.ui.transparency
|
||||||
|
|
|
@ -74,7 +74,7 @@ M.load_mappings = function(section, mapping_opt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local mappings = require("core.utils").load_config().mappings
|
local mappings = require("nvconfig").mappings
|
||||||
|
|
||||||
if type(section) == "string" then
|
if type(section) == "string" then
|
||||||
mappings[section]["plugin"] = nil
|
mappings[section]["plugin"] = nil
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- check default config at core/default_config.lua
|
||||||
|
return require("core.utils").load_config()
|
|
@ -2,7 +2,7 @@ local cmp = require "cmp"
|
||||||
|
|
||||||
dofile(vim.g.base46_cache .. "cmp")
|
dofile(vim.g.base46_cache .. "cmp")
|
||||||
|
|
||||||
local cmp_ui = require("core.utils").load_config().ui.cmp
|
local cmp_ui = require("nvconfig").ui.cmp
|
||||||
local cmp_style = cmp_ui.style
|
local cmp_style = cmp_ui.style
|
||||||
|
|
||||||
local field_arrangement = {
|
local field_arrangement = {
|
||||||
|
|
|
@ -3,14 +3,13 @@ local M = {}
|
||||||
-- export on_attach & capabilities for custom lspconfigs
|
-- export on_attach & capabilities for custom lspconfigs
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
||||||
local utils = require "core.utils"
|
local utils = require "core.utils"
|
||||||
local conf = utils.load_config().ui.lsp
|
local conf = require "nvconfig"
|
||||||
|
|
||||||
-- semanticTokens
|
-- semanticTokens
|
||||||
if not conf.semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
if not conf.semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||||
client.server_capabilities.semanticTokensProvider = nil
|
client.server_capabilities.semanticTokensProvider = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- signature
|
|
||||||
if conf.signature and client.server_capabilities.signatureHelpProvider then
|
if conf.signature and client.server_capabilities.signatureHelpProvider then
|
||||||
require("nvchad.signature").setup(client, bufnr)
|
require("nvchad.signature").setup(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ local default_plugins = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/base46",
|
"NvChad/base46",
|
||||||
branch = "v3.0",
|
branch = "test",
|
||||||
build = function()
|
build = function()
|
||||||
require("base46").load_all_highlights()
|
require("base46").load_all_highlights()
|
||||||
end,
|
end,
|
||||||
|
@ -14,7 +14,7 @@ local default_plugins = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/ui",
|
"NvChad/ui",
|
||||||
branch = "v3.0",
|
branch = "test",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = function()
|
config = function()
|
||||||
require "nvchad"
|
require "nvchad"
|
||||||
|
@ -258,7 +258,7 @@ local default_plugins = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local config = require("core.utils").load_config()
|
local config = require "nvconfig"
|
||||||
|
|
||||||
if #config.plugins > 0 then
|
if #config.plugins > 0 then
|
||||||
table.insert(default_plugins, { import = config.plugins })
|
table.insert(default_plugins, { import = config.plugins })
|
||||||
|
|
Loading…
Reference in New Issue