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