aboutsummaryrefslogtreecommitdiff
path: root/plugins/autoinsert.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2021-07-13 10:47:39 -0400
committerAdam Harrison <adamdharrison@gmail.com>2021-08-17 09:52:24 -0400
commit466798679e7a2889622a491c776530c06668ca9f (patch)
treec0ebb8bdc0cc940f7cce465899a126f0f79a04ba /plugins/autoinsert.lua
parentfb647f8f0d972e85ac323b12eb65edf9c56b48cb (diff)
downloadlite-xl-plugins-466798679e7a2889622a491c776530c06668ca9f.tar.gz
lite-xl-plugins-466798679e7a2889622a491c776530c06668ca9f.zip
Namespaced plugin configs.
Diffstat (limited to 'plugins/autoinsert.lua')
-rw-r--r--plugins/autoinsert.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua
index fd2888a..8be47c9 100644
--- a/plugins/autoinsert.lua
+++ b/plugins/autoinsert.lua
@@ -7,18 +7,18 @@ local command = require "core.command"
local keymap = require "core.keymap"
-config.autoinsert_map = {
+config.plugins.autoinsert = { map = {
["["] = "]",
["{"] = "}",
["("] = ")",
['"'] = '"',
["'"] = "'",
["`"] = "`",
-}
+} }
local function is_closer(chr)
- for _, v in pairs(config.autoinsert_map) do
+ for _, v in pairs(config.plugins.autoinsert.map) do
if v == chr then
return true
end
@@ -37,7 +37,7 @@ end
local on_text_input = DocView.on_text_input
function DocView:on_text_input(text)
- local mapping = config.autoinsert_map[text]
+ local mapping = config.plugins.autoinsert.map[text]
-- prevents plugin from operating on `CommandView`
if getmetatable(self) ~= DocView then
@@ -89,7 +89,7 @@ command.add(predicate, {
local doc = core.active_view.doc
local l, c = doc:get_selection()
local chr = doc:get_char(l, c)
- if config.autoinsert_map[doc:get_char(l, c - 1)] and is_closer(chr) then
+ if config.plugins.autoinsert.map[doc:get_char(l, c - 1)] and is_closer(chr) then
doc:delete_to(1)
end
command.perform "doc:backspace"