-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.lua
More file actions
29 lines (23 loc) · 719 Bytes
/
Copy pathconfig.lua
File metadata and controls
29 lines (23 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local defaults = require("peekstack.config.defaults")
local notify = require("peekstack.util.notify")
local validate = require("peekstack.config.validate")
local M = {}
M.defaults = defaults
---@type PeekstackConfig
local config = vim.deepcopy(M.defaults)
---@param opts? PeekstackConfig
---@return PeekstackConfig
function M.setup(opts)
if opts ~= nil and type(opts) ~= "table" then
notify.warn("setup(opts) expects a table; got " .. type(opts) .. ". Falling back to defaults.")
opts = nil
end
config = vim.tbl_deep_extend("force", vim.deepcopy(M.defaults), opts or {})
validate.run(config, M.defaults)
return config
end
---@return PeekstackConfig
function M.get()
return config
end
return M