refactor: clean & re-organise default_config + chadrc
this completely overhauls the design of the two configuration files, aiming to move options & various tables into a more sensible table structure BREAKING CHANGE: this will break any user modificiations to the current config
This commit is contained in:
parent
80c8bf4243
commit
9961cc0113
9 changed files with 154 additions and 158 deletions
|
|
@ -57,7 +57,7 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
|
|||
},
|
||||
}
|
||||
|
||||
local servers = require("core.utils").load_config().plugins.lspconfig.servers
|
||||
local servers = require("core.utils").load_config().plugins.options.lspconfig.servers
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
local M = {}
|
||||
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
M.autopairs = function()
|
||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
|
|
@ -25,7 +23,7 @@ M.autosave = function()
|
|||
end
|
||||
|
||||
autosave.setup {
|
||||
enabled = config.options.plugin.autosave, -- takes boolean value from chadrc.lua
|
||||
enabled = config.plugins.options.autosave, -- takes boolean value from init.lua
|
||||
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
|
||||
events = { "InsertLeave", "TextChanged" },
|
||||
conditions = {
|
||||
|
|
@ -40,10 +38,10 @@ M.autosave = function()
|
|||
end
|
||||
|
||||
M.better_escape = function()
|
||||
local m = require("core.utils").load_config().mappings.plugin.better_escape.esc_insertmode
|
||||
local config = require("core.utils").load_config()
|
||||
require("better_escape").setup {
|
||||
mapping = m,
|
||||
timeout = config.options.plugin.esc_insertmode_timeout or 300,
|
||||
mapping = config.mappings.plugins.better_escape.esc_insertmode,
|
||||
timeout = config.plugins.options.esc_insertmode_timeout,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ local icon_styles = {
|
|||
},
|
||||
}
|
||||
|
||||
local user_statusline_style = require("core.utils").load_config().ui.plugin.statusline.style
|
||||
local user_statusline_style = require("core.utils").load_config().plugins.options.statusline.style
|
||||
local statusline_style = icon_styles[user_statusline_style]
|
||||
|
||||
-- Initialize the components table
|
||||
|
|
|
|||
|
|
@ -7,16 +7,14 @@ end
|
|||
local use = packer.use
|
||||
|
||||
return packer.startup(function()
|
||||
local plugin_status = require("core.utils").load_config().plugin_status
|
||||
|
||||
-- local plugin_overrides = require("core.utils").load_config().custom.plugin_overrides
|
||||
local plugin_status = require("core.utils").load_config().plugins.plugin_status
|
||||
|
||||
-- FUNCTION: override_req, use `chadrc` plugin config override if present
|
||||
-- name = name inside `default_config` / `chadrc`
|
||||
-- default_req = run this if 'name' does not exist in `default_config` / `chadrc`
|
||||
-- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file
|
||||
local override_req = function(name, default_req)
|
||||
local override = require("core.utils").load_config().custom.default_plugin_overrides[name]
|
||||
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name]
|
||||
local result
|
||||
|
||||
if override == nil then
|
||||
|
|
@ -166,7 +164,7 @@ return packer.startup(function()
|
|||
"Pocco81/AutoSave.nvim",
|
||||
config = override_req("autosave", "(plugins.configs.others).autosave()"),
|
||||
cond = function()
|
||||
return require("core.utils").load_config().options.plugin.autosave == true
|
||||
return require("core.utils").load_config().plugins.options.autosave == true
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue