New feature to disable plugins from config

Disable trimwhitespace by default
This commit is contained in:
Francesco Abbate 2021-01-13 14:50:24 +01:00
parent fcf763fe9c
commit ef5e431a8b
4 changed files with 54 additions and 8 deletions

View File

@ -2,6 +2,11 @@ Lite XL is following closely [rxi/lite](https://github.com/rxi/lite) but with so
This files document the differences between Lite XL and rxi/lite for each version.
### 1.16
Add config mechanism to disable loading of specific plugins by setting
`config.<plugin-name> = false`.
### 1.15
**Project directories**

View File

@ -19,4 +19,8 @@ config.line_limit = 80
config.max_symbols = 4000
config.max_project_files = 2000
-- Disable plugin loading setting to false the config entry
-- of the same name.
config.trimwhitespace = false
return config

View File

@ -252,17 +252,24 @@ local keymap = require "core.keymap"
local config = require "core.config"
local style = require "core.style"
------------------------------ Themes ----------------------------------------
-- light theme:
-- core.reload_module("colors.summer")
--------------------------- Key bindings -------------------------------------
-- key binding:
-- keymap.add { ["ctrl+escape"] = "core:quit" }
------------------------------- Fonts ----------------------------------------
-- customize fonts:
-- style.font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 14 * SCALE)
-- style.code_font = renderer.font.load(DATADIR .. "/fonts/monospace.ttf", 13.5 * SCALE)
--
-- fonts used by the editor:
-- font names used by lite:
-- style.font : user interface
-- style.big_font : big text in welcome screen
-- style.icon_font : icons
@ -275,6 +282,16 @@ local style = require "core.style"
-- possible values are:
-- antialiasing: grayscale, subpixel
-- hinting: none, slight, full
------------------------------ Plugins ----------------------------------------
-- enable or disable plugin loading setting config entries:
-- enable trimwhitespace, otherwise it is disable by default:
-- config.trimwhitespace = true
--
-- disable detectindent, otherwise it is enabled by default
-- config.detectindent = false
]])
init_file:close()
end
@ -483,7 +500,9 @@ function core.load_plugins()
for _, root_dir in ipairs {DATADIR, USERDIR} do
local files = system.list_dir(root_dir .. "/plugins")
for _, filename in ipairs(files or {}) do
local modname = "plugins." .. filename:gsub(".lua$", "")
local basename = filename:gsub(".lua$", "")
if config[basename] ~= false then
local modname = "plugins." .. basename
local ok = core.try(require, modname)
if ok then
core.log_quiet("Loaded plugin %q", modname)
@ -492,6 +511,7 @@ function core.load_plugins()
end
end
end
end
return no_errors
end

View File

@ -7,17 +7,24 @@ local keymap = require "core.keymap"
local config = require "core.config"
local style = require "core.style"
------------------------------ Themes ----------------------------------------
-- light theme:
-- core.reload_module("colors.summer")
--------------------------- Key bindings -------------------------------------
-- key binding:
-- keymap.add { ["ctrl+escape"] = "core:quit" }
------------------------------- Fonts ----------------------------------------
-- customize fonts:
-- style.font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 14 * SCALE)
-- style.code_font = renderer.font.load(DATADIR .. "/fonts/monospace.ttf", 13.5 * SCALE)
--
-- fonts used by the editor:
-- font names used by lite:
-- style.font : user interface
-- style.big_font : big text in welcome screen
-- style.icon_font : icons
@ -30,3 +37,13 @@ local style = require "core.style"
-- possible values are:
-- antialiasing: grayscale, subpixel
-- hinting: none, slight, full
------------------------------ Plugins ----------------------------------------
-- enable or disable plugin loading setting config entries:
-- enable trimwhitespace, otherwise it is disable by default:
-- config.trimwhitespace = true
--
-- disable detectindent, otherwise it is enabled by default
-- config.detectindent = false