Added in new merge method, and run it on plugins. Also made it so plugin configs can be set anywhere, even if we don't know the plugin beforehand.
This commit is contained in:
parent
a607ef95f9
commit
d13315ecb9
|
@ -17,6 +17,14 @@ function common.clamp(n, lo, hi)
|
|||
end
|
||||
|
||||
|
||||
function common.merge(a, b)
|
||||
local t = {}
|
||||
for k, v in pairs(a) do t[k] = v end
|
||||
if b then for k, v in pairs(b) do t[k] = v end end
|
||||
return t
|
||||
end
|
||||
|
||||
|
||||
function common.round(n)
|
||||
return n >= 0 and math.floor(n + 0.5) or math.ceil(n - 0.5)
|
||||
end
|
||||
|
|
|
@ -29,10 +29,16 @@ config.borderless = false
|
|||
config.tab_close_button = true
|
||||
config.max_clicks = 3
|
||||
|
||||
-- Disable plugin loading setting to false the config entry
|
||||
-- of the same name.
|
||||
config.plugins = {}
|
||||
-- Allow you to set plugin configs even if we haven't seen the plugin before.
|
||||
setmetatable(config.plugins, {
|
||||
__index = function(t, k)
|
||||
if rawget(t, k) == nil then rawset(t, k, {}) end
|
||||
return rawget(t, k)
|
||||
end
|
||||
})
|
||||
|
||||
-- Disable these plugins by default.
|
||||
config.plugins.trimwhitespace = false
|
||||
config.plugins.lineguide = false
|
||||
config.plugins.drawwhitespace = false
|
||||
|
|
|
@ -10,14 +10,14 @@ local RootView = require "core.rootview"
|
|||
local DocView = require "core.docview"
|
||||
local Doc = require "core.doc"
|
||||
|
||||
config.plugins.autocomplete = {
|
||||
config.plugins.autocomplete = common.merge({
|
||||
-- Amount of characters that need to be written for autocomplete
|
||||
min_len = 3,
|
||||
-- The max amount of visible items
|
||||
max_height = 6,
|
||||
-- The max amount of scrollable items
|
||||
max_suggestions = 100,
|
||||
}
|
||||
}, config.plugins.autocomplete)
|
||||
|
||||
local autocomplete = {}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ local style = require "core.style"
|
|||
local RootView = require "core.rootview"
|
||||
local CommandView = require "core.commandview"
|
||||
|
||||
config.plugins.scale = {
|
||||
config.plugins.scale = common.merge({
|
||||
mode = "code",
|
||||
use_mousewheel = true
|
||||
}
|
||||
}, config.plugins.scale)
|
||||
|
||||
local scale_steps = 0.05
|
||||
|
||||
|
|
Loading…
Reference in New Issue