changes
This commit is contained in:
@@ -14,7 +14,10 @@ M.config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
|
opts = opts or {}
|
||||||
|
|
||||||
|
-- Make sure nested tables are deep-merged
|
||||||
|
M.config.terminal = vim.tbl_deep_extend("force", M.config.terminal, opts.terminal or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ M.config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.config = utils.deep_merge_with_defaults(opts, M.config)
|
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
|
||||||
|
|
||||||
for key, command in pairs(M.config.keybinds) do
|
for key, command in pairs(M.config.keybinds) do
|
||||||
if command == "PythonRun" then M.c_run = key end
|
if command == "PythonRun" then M.c_run = key end
|
||||||
if command == "PythonPip" then M.new_pip_module = key end
|
if command == "PythonPip" then M.new_pip_module = key end
|
||||||
|
|||||||
@@ -1,23 +1,6 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
local term_cfg = require("Polydev.globals").config.terminal
|
local term_cfg = require("Polydev.globals").config.terminal
|
||||||
|
|
||||||
function M.deep_merge_with_defaults(user_opts, default_opts)
|
|
||||||
local result = vim.deepcopy(default_opts or {})
|
|
||||||
|
|
||||||
local function merge(user, default)
|
|
||||||
for k, v in pairs(default) do
|
|
||||||
if type(v) == "table" and type(user[k]) == "table" then
|
|
||||||
merge(user[k], v)
|
|
||||||
elseif user[k] == nil then
|
|
||||||
user[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
merge(user_opts or {}, result)
|
|
||||||
return user_opts or result
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.write_file(path, content)
|
function M.write_file(path, content)
|
||||||
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
|
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
|
||||||
file:write(content)
|
file:write(content)
|
||||||
|
|||||||
Reference in New Issue
Block a user