]> git.r.bdr.sh - rbdr/oleoboard.nvim/blob - lua/oleoboard/configuration.lua
1e4d85b56c151f33fa5705d75987b3f63b7eacad
[rbdr/oleoboard.nvim] / lua / oleoboard / configuration.lua
1 -------------------------------------------------------------------------------
2 -- Configuration for board
3 -------------------------------------------------------------------------------
4 local Configuration = {}
5
6 -------------------------------------------------------------------------------
7 -- Internal Functions
8 -------------------------------------------------------------------------------
9 local fs = vim.loop
10
11 local defaults = {
12 default_keybinds = true, -- Whether or not to set the default keybinds
13 }
14
15 -- Recursively extends a table with another
16 local function extend(target, extender)
17 for key, value in pairs(extender) do
18 if type(target[key]) == 'table' and type(value) == 'table' then
19 extend(target[key], value)
20 else
21 target[key] = value
22 end
23 end
24 end
25
26 -------------------------------------------------------------------------------
27 -- Public Interface
28 -------------------------------------------------------------------------------
29
30 Configuration.configuration = {}
31 extend(Configuration.configuration, defaults)
32
33 --- Extends configuration with another configuration
34 function Configuration.configure(configuration)
35 configuration = configuration or {}
36 extend(Configuration.configuration, configuration)
37 end
38
39 return Configuration