configs should update properly
This commit is contained in:
+10
-20
@@ -1,9 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
---@param project_root string
|
||||
---@return table
|
||||
local function default_languages(project_root)
|
||||
return {
|
||||
M.user_config = {}
|
||||
|
||||
---@param user_opts table
|
||||
function M.setup(user_opts)
|
||||
user_opts = user_opts or {}
|
||||
local project_root = (user_opts.globals and user_opts.globals.project_root) or "~/personal/Projects"
|
||||
local defaults = {
|
||||
rust = {
|
||||
project_root = project_root .. "/Rust",
|
||||
keybinds = {
|
||||
@@ -50,18 +53,10 @@ local function default_languages(project_root)
|
||||
html = {
|
||||
project_root = project_root .. "/Html",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.user_config = {}
|
||||
|
||||
---@param user_opts table
|
||||
function M.setup(user_opts)
|
||||
local defaults = {
|
||||
globals = {
|
||||
project_root = "~/personal/Projects",
|
||||
project_root = project_root,
|
||||
keybinds = {
|
||||
["<leader>po"] = "PolydevManager",
|
||||
["<leader>po"] = "PolydevOpen",
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
@@ -76,12 +71,7 @@ function M.setup(user_opts)
|
||||
},
|
||||
}
|
||||
|
||||
M.user_config = vim.tbl_deep_extend("force", {}, defaults, user_opts or {})
|
||||
local langs = default_languages(M.user_config.globals.project_root)
|
||||
|
||||
for lang, conf in pairs(langs) do
|
||||
M.user_config[lang] = vim.tbl_deep_extend("force", conf, M.user_config[lang] or {})
|
||||
end
|
||||
M.user_config = vim.tbl_deep_extend("force", defaults, user_opts)
|
||||
end
|
||||
|
||||
---@param lang string
|
||||
|
||||
Reference in New Issue
Block a user