Merge pull request #333 from adamharrison/namespace-config
Namespace plugin configs
This commit is contained in:
commit
0426fc26c2
|
@ -28,7 +28,9 @@ config.tab_close_button = true
|
||||||
|
|
||||||
-- Disable plugin loading setting to false the config entry
|
-- Disable plugin loading setting to false the config entry
|
||||||
-- of the same name.
|
-- of the same name.
|
||||||
config.trimwhitespace = false
|
config.plugins = {}
|
||||||
config.lineguide = false
|
|
||||||
|
config.plugins.trimwhitespace = false
|
||||||
|
config.plugins.lineguide = false
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
|
@ -712,7 +712,7 @@ function core.load_plugins()
|
||||||
local ls = refused_list[root_dir == USERDIR and 'userdir' or 'datadir'].plugins
|
local ls = refused_list[root_dir == USERDIR and 'userdir' or 'datadir'].plugins
|
||||||
ls[#ls + 1] = filename
|
ls[#ls + 1] = filename
|
||||||
end
|
end
|
||||||
if version_match and config[basename] ~= false then
|
if version_match and config.plugins[basename] ~= false then
|
||||||
local modname = "plugins." .. basename
|
local modname = "plugins." .. basename
|
||||||
local ok = core.try(require, modname)
|
local ok = core.try(require, modname)
|
||||||
if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end
|
if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end
|
||||||
|
|
|
@ -9,7 +9,7 @@ local translate = require "core.doc.translate"
|
||||||
local RootView = require "core.rootview"
|
local RootView = require "core.rootview"
|
||||||
local DocView = require "core.docview"
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
config.autocomplete_max_suggestions = 6
|
config.plugins.autocomplete = { max_suggestions = 6 }
|
||||||
|
|
||||||
local autocomplete = {}
|
local autocomplete = {}
|
||||||
autocomplete.map = {}
|
autocomplete.map = {}
|
||||||
|
@ -129,7 +129,7 @@ local function update_suggestions()
|
||||||
-- fuzzy match, remove duplicates and store
|
-- fuzzy match, remove duplicates and store
|
||||||
items = common.fuzzy_match(items, partial)
|
items = common.fuzzy_match(items, partial)
|
||||||
local j = 1
|
local j = 1
|
||||||
for i = 1, config.autocomplete_max_suggestions do
|
for i = 1, config.plugins.autocomplete.max_suggestions do
|
||||||
suggestions[i] = items[j]
|
suggestions[i] = items[j]
|
||||||
while items[j] and items[i].text == items[j].text do
|
while items[j] and items[i].text == items[j].text do
|
||||||
items[i].info = items[i].info or items[j].info
|
items[i].info = items[i].info or items[j].info
|
||||||
|
|
|
@ -8,8 +8,10 @@ local style = require "core.style"
|
||||||
local RootView = require "core.rootview"
|
local RootView = require "core.rootview"
|
||||||
local CommandView = require "core.commandview"
|
local CommandView = require "core.commandview"
|
||||||
|
|
||||||
config.scale_mode = "code"
|
config.plugins.scale = {
|
||||||
config.scale_use_mousewheel = true
|
mode = "code",
|
||||||
|
use_mousewheel = true
|
||||||
|
}
|
||||||
|
|
||||||
local scale_level = 0
|
local scale_level = 0
|
||||||
local scale_steps = 0.05
|
local scale_steps = 0.05
|
||||||
|
@ -35,7 +37,7 @@ local function set_scale(scale)
|
||||||
-- we set scale_level in case this was called by user
|
-- we set scale_level in case this was called by user
|
||||||
scale_level = (scale - default_scale) / scale_steps
|
scale_level = (scale - default_scale) / scale_steps
|
||||||
|
|
||||||
if config.scale_mode == "ui" then
|
if config.plugins.scale.mode == "ui" then
|
||||||
SCALE = scale
|
SCALE = scale
|
||||||
|
|
||||||
style.padding.x = style.padding.x * s
|
style.padding.x = style.padding.x * s
|
||||||
|
@ -68,7 +70,7 @@ end
|
||||||
local on_mouse_wheel = RootView.on_mouse_wheel
|
local on_mouse_wheel = RootView.on_mouse_wheel
|
||||||
|
|
||||||
function RootView:on_mouse_wheel(d, ...)
|
function RootView:on_mouse_wheel(d, ...)
|
||||||
if keymap.modkeys["ctrl"] and config.scale_use_mousewheel then
|
if keymap.modkeys["ctrl"] and config.plugins.scale.use_mousewheel then
|
||||||
if d < 0 then command.perform "scale:decrease" end
|
if d < 0 then command.perform "scale:decrease" end
|
||||||
if d > 0 then command.perform "scale:increase" end
|
if d > 0 then command.perform "scale:increase" end
|
||||||
else
|
else
|
||||||
|
|
|
@ -358,7 +358,7 @@ local treeview_node = node:split("left", view, {x = true}, true)
|
||||||
-- in the treeview node.
|
-- in the treeview node.
|
||||||
local toolbar_view = nil
|
local toolbar_view = nil
|
||||||
local toolbar_plugin, ToolbarView = core.try(require, "plugins.toolbarview")
|
local toolbar_plugin, ToolbarView = core.try(require, "plugins.toolbarview")
|
||||||
if config.toolbarview ~= false and toolbar_plugin then
|
if config.plugins.toolbarview ~= false and toolbar_plugin then
|
||||||
toolbar_view = ToolbarView()
|
toolbar_view = ToolbarView()
|
||||||
treeview_node:split("down", toolbar_view, {y = true})
|
treeview_node:split("down", toolbar_view, {y = true})
|
||||||
local min_toolbar_width = toolbar_view:get_min_width()
|
local min_toolbar_width = toolbar_view:get_min_width()
|
||||||
|
|
Loading…
Reference in New Issue