aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2021-12-05 22:56:04 -0500
committerjgmdev <jgmdev@gmail.com>2022-05-22 13:02:00 -0400
commit3fcf065be6387c5bb38a46924f5ea1a7bb17850d (patch)
tree19b3c571c7e1beae325049e56e3df12a0a647637
parentc569b3b3697c1656c78ec4b4d233d4ed78fa898a (diff)
downloadlite-xl-plugins-3fcf065be6387c5bb38a46924f5ea1a7bb17850d.tar.gz
lite-xl-plugins-3fcf065be6387c5bb38a46924f5ea1a7bb17850d.zip
Appropriately merged config hashes.
-rw-r--r--plugins/autoinsert.lua5
-rw-r--r--plugins/autosave.lua3
-rw-r--r--plugins/autowrap.lua2
-rw-r--r--plugins/bigclock.lua4
-rw-r--r--plugins/datetimestamps.lua5
-rw-r--r--plugins/fontconfig.lua3
-rw-r--r--plugins/indent_convert.lua5
-rw-r--r--plugins/lfautoinsert.lua4
-rw-r--r--plugins/minimap.lua4
-rw-r--r--plugins/motiontrail.lua3
-rw-r--r--plugins/openfilelocation.lua15
-rw-r--r--plugins/openselected.lua16
-rw-r--r--plugins/scalestatus.lua4
-rw-r--r--plugins/smoothcaret.lua3
-rw-r--r--plugins/spellcheck.lua12
-rw-r--r--plugins/statusclock.lua5
16 files changed, 50 insertions, 43 deletions
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua
index d0b8404..dd126c8 100644
--- a/plugins/autoinsert.lua
+++ b/plugins/autoinsert.lua
@@ -2,19 +2,20 @@
local core = require "core"
local translate = require "core.doc.translate"
local config = require "core.config"
+local common = require "core.common"
local DocView = require "core.docview"
local command = require "core.command"
local keymap = require "core.keymap"
-config.plugins.autoinsert = { map = {
+config.plugins.autoinsert = common.merge({ map = {
["["] = "]",
["{"] = "}",
["("] = ")",
['"'] = '"',
["'"] = "'",
["`"] = "`",
-} }
+} }, config.plugins.autoinsert)
local function is_closer(chr)
diff --git a/plugins/autosave.lua b/plugins/autosave.lua
index 8c79e8d..34d2ad6 100644
--- a/plugins/autosave.lua
+++ b/plugins/autosave.lua
@@ -3,13 +3,14 @@ local core = require "core"
local config = require "core.config"
local Doc = require "core.doc"
local command = require "core.command"
+local common = require "core.common"
-- this is used to detect the wait time
local last_keypress = os.time()
-- this exists so that we don't end up with multiple copies of the loop running at once
local looping = false
local on_text_change = Doc.on_text_change
-- the approximate amount of time, in seconds, that it takes to trigger an autosave
-config.plugins.autosave = { timeout = 1 }
+config.plugins.autosave = common.merge({ timeout = 1 }, config.plugins.autosave)
local function loop_for_save()
diff --git a/plugins/autowrap.lua b/plugins/autowrap.lua
index a44094a..0f34eec 100644
--- a/plugins/autowrap.lua
+++ b/plugins/autowrap.lua
@@ -4,7 +4,7 @@ local config = require "core.config"
local command = require "core.command"
local DocView = require "core.docview"
-config.plugins.autowrap = { files = { "%.md$", "%.txt$" } }
+config.plugins.autowrap = common.merge({ files = { "%.md$", "%.txt$" } }, config.plugins.autowrap)
local on_text_input = DocView.on_text_input
diff --git a/plugins/bigclock.lua b/plugins/bigclock.lua
index 82c3fe4..a7b4958 100644
--- a/plugins/bigclock.lua
+++ b/plugins/bigclock.lua
@@ -7,11 +7,11 @@ local config = require "core.config"
local View = require "core.view"
-config.plugins.bigclock = {
+config.plugins.bigclock = common.merge({
time_format = "%H:%M:%S",
date_format = "%A, %d %B %Y",
scale = 1
-}
+}, config.plugins.bigclock)
local ClockView = View:extend()
diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua
index c08547f..bd208f7 100644
--- a/plugins/datetimestamps.lua
+++ b/plugins/datetimestamps.lua
@@ -2,6 +2,7 @@
local core = require "core"
local config = require "core.config"
local command = require "core.command"
+local common = require "core.common"
--[[
Date and time format placeholders
@@ -25,11 +26,11 @@ from https://www.lua.org/pil/22.1.html
%y two-digit year (98) [00-99]
%% the character `%ยด
--]]
-config.plugins.datetimestamps = {
+config.plugins.datetimestamps = common.merge({
format_datestamp = "%Y%m%d"
format_datetimestamp = "%Y%m%d_%H%M%S"
format_timestamp = "%H%M%S"
-}
+}, config.plugins.datetimestamps)
local function datestamp()
local sOut = os.date(config.plugins.datetimestamps.format_datestamp)
diff --git a/plugins/fontconfig.lua b/plugins/fontconfig.lua
index 11e7fca..6b1047c 100644
--- a/plugins/fontconfig.lua
+++ b/plugins/fontconfig.lua
@@ -4,8 +4,9 @@ local subprocess = require "process"
local core = require "core"
local style = require "core.style"
local config = require "core.config"
+local common = require "core.common"
-config.plugins.fontconfig = { prefix = "" }
+config.plugins.fontconfig = common.merge({ prefix = "" }, config.plugins.fontconfig)
--[[
Example config (put it in user module):
diff --git a/plugins/indent_convert.lua b/plugins/indent_convert.lua
index 3c22867..2442b39 100644
--- a/plugins/indent_convert.lua
+++ b/plugins/indent_convert.lua
@@ -1,11 +1,12 @@
-- mod-version:3 --lite-xl 2.1
local core = require "core"
+local common = require "core.common"
local config = require "core.config"
local command = require "core.command"
-config.plugins.indent_convert = {
+config.plugins.indent_convert = common.merge({
update_indent_type = true -- set to false to avoid updating the document indent type
-}
+}, config.plugins.indent_convert)
local zero_pattern = _VERSION == "Lua 5.1" and "%z" or "\0"
diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua
index bc3c460..138f48f 100644
--- a/plugins/lfautoinsert.lua
+++ b/plugins/lfautoinsert.lua
@@ -5,7 +5,7 @@ local common = require "core.common"
local config = require "core.config"
local keymap = require "core.keymap"
-config.plugins.lfautoinsert = { map = {
+config.plugins.lfautoinsert = common.merge({ map = {
["{%s*\n"] = "}",
["%(%s*\n"] = ")",
["%f[[]%[%s*\n"] = "]",
@@ -37,7 +37,7 @@ config.plugins.lfautoinsert = { map = {
["%[%[%s*\n"] = "]]"
}
},
-} }
+} }, config.plugins.lfautoinsert)
local function get_autoinsert_map(filename)
local map = {}
diff --git a/plugins/minimap.lua b/plugins/minimap.lua
index 7bf0a92..977e2ee 100644
--- a/plugins/minimap.lua
+++ b/plugins/minimap.lua
@@ -8,7 +8,7 @@ local DocView = require "core.docview"
local Object = require "core.object"
-- General plugin settings
-config.plugins.minimap = {
+config.plugins.minimap = common.merge({
enabled = true,
width = 100,
instant_scroll = false,
@@ -39,7 +39,7 @@ config.plugins.minimap = {
-- config.plugins.minimap.highlight_align = 'right'
-- config.plugins.minimap.highlight_width = 5
-- config.plugins.minimap.gutter_width = 0
-}
+}, config.plugins.minimap)
-- Configure size for rendering each char in the minimap
local char_height = 1 * SCALE * config.plugins.minimap.scale
diff --git a/plugins/motiontrail.lua b/plugins/motiontrail.lua
index 4ed99ae..112e1cd 100644
--- a/plugins/motiontrail.lua
+++ b/plugins/motiontrail.lua
@@ -1,10 +1,11 @@
-- mod-version:3 --lite-xl 2.1
local core = require "core"
local config = require "core.config"
+local common = require "core.common"
local style = require "core.style"
local DocView = require "core.docview"
-config.plugins.motiontrail = { steps = 50 }
+config.plugins.motiontrail = common.merge({ steps = 50 }, config.plugins.motiontrail)
local function lerp(a, b, t)
diff --git a/plugins/openfilelocation.lua b/plugins/openfilelocation.lua
index b16ee82..0328142 100644
--- a/plugins/openfilelocation.lua
+++ b/plugins/openfilelocation.lua
@@ -5,15 +5,16 @@ local config = require "core.config"
config.plugins.openfilelocation = {}
-if PLATFORM == "Windows" then
- config.plugins.openfilelocation.filemanager = "explorer"
-elseif PLATFORM == "Mac OS X" then
- config.plugins.openfilelocation.filemanager = "open"
-else
- config.plugins.openfilelocation.filemanager = "xdg-open"
+if not config.plugins.openfilelocation.filemanager then
+ if PLATFORM == "Windows" then
+ config.plugins.openfilelocation.filemanager = "explorer"
+ elseif PLATFORM == "Mac OS X" then
+ config.plugins.openfilelocation.filemanager = "open"
+ else
+ config.plugins.openfilelocation.filemanager = "xdg-open"
+ end
end
-
command.add("core.docview", {
["open-file-location:open-file-location"] = function()
local doc = core.active_view.doc
diff --git a/plugins/openselected.lua b/plugins/openselected.lua
index 0a7a58a..02312b5 100644
--- a/plugins/openselected.lua
+++ b/plugins/openselected.lua
@@ -2,19 +2,21 @@
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
+local common = require "core.common"
local config = require "core.config"
config.plugins.openselected = {}
-if PLATFORM == "Windows" then
- config.plugins.openselected.filemanager = "start"
-elseif PLATFORM == "Mac OS X" then
- config.plugins.openselected.filemanager = "open"
-else
- config.plugins.openselected.filemanager = "xdg-open"
+if not config.plugins.openselected.filemanager then
+ if PLATFORM == "Windows" then
+ config.plugins.openselected.filemanager = "start"
+ elseif PLATFORM == "Mac OS X" then
+ config.plugins.openselected.filemanager = "open"
+ else
+ config.plugins.openselected.filemanager = "xdg-open"
+ end
end
-
command.add("core.docview", {
["open-selected:open-selected"] = function()
local doc = core.active_view.doc
diff --git a/plugins/scalestatus.lua b/plugins/scalestatus.lua
index 09b62fd..008feaf 100644
--- a/plugins/scalestatus.lua
+++ b/plugins/scalestatus.lua
@@ -6,11 +6,11 @@
originally by SwissalpS
--]]
local scale = require "plugins.scale"
-
+local common = require "core.common"
local config = require "core.config"
local StatusView = require "core.statusview"
-config.plugins.scalestatus = { format = '%.0f%%' }
+config.plugins.scalestatus = common.merge({ format = '%.0f%%' }, config.plugins.scalestatus)
local get_items = StatusView.get_items
function StatusView:get_items()
diff --git a/plugins/smoothcaret.lua b/plugins/smoothcaret.lua
index 2c05664..335dd08 100644
--- a/plugins/smoothcaret.lua
+++ b/plugins/smoothcaret.lua
@@ -2,9 +2,10 @@
local core = require "core"
local config = require "core.config"
local style = require "core.style"
+local common = require "core.common"
local DocView = require "core.docview"
-config.plugins.smoothcaret = { rate = 0.65 }
+config.plugins.smoothcaret = common.merge({ rate = 0.65 }, config.plugins.smoothcaret)
local docview_update = DocView.update
function DocView:update()
diff --git a/plugins/spellcheck.lua b/plugins/spellcheck.lua
index b0626a9..190087a 100644
--- a/plugins/spellcheck.lua
+++ b/plugins/spellcheck.lua
@@ -7,14 +7,10 @@ local common = require "core.common"
local DocView = require "core.docview"
local Doc = require "core.doc"
-config.plugins.spellcheck = {}
-config.plugins.spellcheck.files = { "%.txt$", "%.md$", "%.markdown$" }
-if PLATFORM == "Windows" then
- config.plugins.spellcheck.dictionary_file = EXEDIR .. "/words.txt"
-else
- config.plugins.spellcheck.dictionary_file = "/usr/share/dict/words"
-end
-
+config.plugins.spellcheck = common.merge({
+ files = { "%.txt$", "%.md$", "%.markdown$" },
+ dictionary_file = (PLATFORM == "Windows" and EXEDIR .. "/words.txt" or "/usr/share/dict/words")
+}, config.plugins.spellcheck)
local last_input_time = 0
local word_pattern = "%a+"
diff --git a/plugins/statusclock.lua b/plugins/statusclock.lua
index a2155df..139ae23 100644
--- a/plugins/statusclock.lua
+++ b/plugins/statusclock.lua
@@ -2,13 +2,14 @@
local core = require "core"
local config = require "core.config"
local style = require "core.style"
+local common = require "core.common"
local StatusView = require "core.statusview"
local scan_rate = 1
-config.plugins.statusclock = {
+config.plugins.statusclock = common.merge({
time_format = "%H:%M:%S",
date_format = "%A, %d %B %Y"
-}
+}, config.plugins.statusclock)
local time_data = {
time_text = '',