aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco <francesco.bbt@gmail.com>2021-08-17 22:44:17 +0200
committerGitHub <noreply@github.com>2021-08-17 22:44:17 +0200
commit49d3d21c987645b448184a752043946ed90d6031 (patch)
treeb187286f2ed78fa9317f288dc0c5144840bcdad9
parenta42a0d57b08a9080ed9fd8fa84f1269e3847980f (diff)
parent9689846686f77dc0aa1e6f4d31fbfc42998c2085 (diff)
downloadlite-xl-plugins-49d3d21c987645b448184a752043946ed90d6031.tar.gz
lite-xl-plugins-49d3d21c987645b448184a752043946ed90d6031.zip
Merge pull request #45 from lite-xl/2.0
2.0 Merge
-rw-r--r--README.md4
-rw-r--r--plugins/autoinsert.lua12
-rw-r--r--plugins/autosave.lua8
-rw-r--r--plugins/autosaveonfocuslost.lua2
-rw-r--r--plugins/autowrap.lua6
-rw-r--r--plugins/bigclock.lua16
-rw-r--r--plugins/bracketmatch.lua2
-rw-r--r--plugins/centerdoc.lua2
-rw-r--r--plugins/colorpreview.lua2
-rw-r--r--plugins/copyfilelocation.lua4
-rw-r--r--plugins/datetimestamps.lua25
-rw-r--r--plugins/dragdropselected.lua2
-rw-r--r--plugins/ephemeraldocviews.lua2
-rw-r--r--plugins/eval.lua2
-rw-r--r--plugins/exec.lua2
-rw-r--r--plugins/ghmarkdown.lua2
-rw-r--r--plugins/gitstatus.lua2
-rw-r--r--plugins/gofmt.lua2
-rw-r--r--plugins/hidelinenumbers.lua2
-rw-r--r--plugins/hidestatus.lua2
-rw-r--r--plugins/indentguide.lua2
-rw-r--r--plugins/language_angelscript.lua2
-rw-r--r--plugins/language_batch.lua2
-rw-r--r--plugins/language_bib.lua2
-rw-r--r--plugins/language_cmake.lua2
-rw-r--r--plugins/language_cpp.lua2
-rw-r--r--plugins/language_csharp.lua2
-rw-r--r--plugins/language_d.lua2
-rw-r--r--plugins/language_dart.lua2
-rw-r--r--plugins/language_elixir.lua2
-rw-r--r--plugins/language_elm.lua2
-rw-r--r--plugins/language_fe.lua2
-rw-r--r--plugins/language_fennel.lua2
-rw-r--r--plugins/language_gdscript.lua2
-rw-r--r--plugins/language_glsl.lua2
-rw-r--r--plugins/language_go.lua2
-rw-r--r--plugins/language_hlsl.lua2
-rw-r--r--plugins/language_hs.lua2
-rw-r--r--plugins/language_java.lua2
-rw-r--r--plugins/language_jiyu.lua2
-rw-r--r--plugins/language_jsx.lua2
-rw-r--r--plugins/language_liquid.lua2
-rw-r--r--plugins/language_make.lua2
-rw-r--r--plugins/language_meson.lua2
-rw-r--r--plugins/language_moon.lua2
-rw-r--r--plugins/language_nim.lua2
-rw-r--r--plugins/language_objc.lua2
-rw-r--r--plugins/language_odin.lua2
-rw-r--r--plugins/language_perl.lua2
-rw-r--r--plugins/language_php.lua2
-rw-r--r--plugins/language_phps.lua2
-rw-r--r--plugins/language_pico8.lua2
-rw-r--r--plugins/language_po.lua2
-rw-r--r--plugins/language_powershell.lua2
-rw-r--r--plugins/language_psql.lua2
-rw-r--r--plugins/language_ruby.lua2
-rw-r--r--plugins/language_rust.lua2
-rw-r--r--plugins/language_sass.lua2
-rw-r--r--plugins/language_sh.lua2
-rw-r--r--plugins/language_tcl.lua2
-rw-r--r--plugins/language_teal.lua2
-rw-r--r--plugins/language_tex.lua2
-rw-r--r--plugins/language_ts.lua2
-rw-r--r--plugins/language_tsx.lua2
-rw-r--r--plugins/language_v.lua2
-rw-r--r--plugins/language_wren.lua2
-rw-r--r--plugins/language_yaml.lua2
-rw-r--r--plugins/language_zig.lua2
-rw-r--r--plugins/lfautoinsert.lua10
-rwxr-xr-xplugins/linecopypaste.lua2
-rw-r--r--plugins/lineguide.lua21
-rw-r--r--plugins/macmodkeys.lua2
-rw-r--r--plugins/markers.lua2
-rw-r--r--plugins/memoryusage.lua2
-rw-r--r--plugins/minimap.lua56
-rw-r--r--plugins/motiontrail.lua6
-rw-r--r--plugins/navigate.lua2
-rw-r--r--plugins/openfilelocation.lua13
-rw-r--r--plugins/openselected.lua2
-rw-r--r--plugins/pdfview.lua2
-rw-r--r--plugins/rainbowparen.lua2
-rw-r--r--plugins/regexreplacepreview.lua2
-rw-r--r--plugins/restoretabs.lua2
-rw-r--r--plugins/scale.lua142
-rw-r--r--plugins/scalestatus.lua14
-rw-r--r--plugins/selectionhighlight.lua3
-rw-r--r--plugins/smallclock.lua2
-rw-r--r--plugins/sort.lua2
-rw-r--r--plugins/spellcheck.lua17
-rw-r--r--plugins/tabnumbers.lua2
-rw-r--r--plugins/texcompile.lua2
-rw-r--r--plugins/themeselect.lua2
-rw-r--r--plugins/titleize.lua2
-rw-r--r--plugins/togglesnakecamel.lua2
-rw-r--r--plugins/unboundedscroll.lua2
95 files changed, 169 insertions, 346 deletions
diff --git a/README.md b/README.md
index f24ad2e..635e58d 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ Plugin | Description
~~[`lastproject`](plugins/lastproject.lua?raw=1)~~ | Integrated with lite-xl ~~Loads the last loaded project if lite is launched without any arguments~~
[`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline
[`linecopypaste`](plugins/linecopypaste.lua?raw=1) | Copy, cut and paste the current line when nothing is selected
-[*`lineguide`*](plugins/lineguide.lua?raw=1) | Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.png))*
+~~[*`lineguide`*](plugins/lineguide.lua?raw=1)~~ | Integrated with lite-xl ~~Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.png))*~~
[`linenumbers`](plugins/linenumbers.lua?raw=1) | The ability to change the display of the line number *([screenshot](https://user-images.githubusercontent.com/5556081/129493788-6a4cbd7a-9074-4133-bab7-110ed55f18f7.png))*
[`linter`](https://github.com/drmargarido/linters)* | Linters for multiple languages
[`lint+`](https://github.com/liquid600pgm/lintplus)* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))*
@@ -113,7 +113,7 @@ Plugin | Description
[`rainbowparen`](plugins/rainbowparen.lua?raw=1) | Show nesting of parentheses with rainbow colours
[`regexreplaceplugin`](plugins/regexreplaceplugin.lua?raw=1) | Allows for you to write a regex and its replacement in one go, and live preview the results.
[`restoretabs`](plugins/restoretabs.lua?raw=1) | Keep a list of recently closed tabs, and restore the tab in order on cntrl+shift+t.
-*[`scale`](plugins/scale.lua?raw=1)* | Provides support for dynamically adjusting the scale of the code font / UI (`ctrl+-`, `ctrl+=`)
+~~`scale`~~ | Integrated in lite-xl with improvements ~~Provides support for dynamically adjusting the scale of the code font / UI (`ctrl+-`, `ctrl+=`)~~
[`scalestatus`](plugins/scalestatus.lua?raw=1) | Displays current scale (zoom) in status view (depends on scale plugin)
[`selectionhighlight`](plugins/selectionhighlight.lua?raw=1) | Highlights regions of code that match the current selection *([screenshot](https://user-images.githubusercontent.com/3920290/80710883-5f597c80-8ae7-11ea-97f0-76dfacc08439.png))*
[`smallclock`](plugins/smallclock.lua?raw=1) | Displays the current time in the corner of the status view
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua
index 7af2209..638d6cc 100644
--- a/plugins/autoinsert.lua
+++ b/plugins/autoinsert.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local translate = require "core.doc.translate"
local config = require "core.config"
@@ -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"
diff --git a/plugins/autosave.lua b/plugins/autosave.lua
index 06992ea..9518adf 100644
--- a/plugins/autosave.lua
+++ b/plugins/autosave.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local config = require "core.config"
local Doc = require "core.doc"
@@ -9,18 +9,18 @@ local last_keypress = os.time()
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.autosave_timeout = 1
+config.plugins.autosave = { timeout = 1 }
local function loop_for_save()
while looping do
- if os.difftime(os.time(), last_keypress) >= config.autosave_timeout then
+ if os.difftime(os.time(), last_keypress) >= config.plugins.autosave.timeout then
command.perform "doc:save"
-- stop loop
looping = false
end
-- wait the timeout. may cause timeout to be slightly imprescise
- coroutine.yield(config.autosave_timeout)
+ coroutine.yield(config.plugins.autosave.timeout)
end
end
diff --git a/plugins/autosaveonfocuslost.lua b/plugins/autosaveonfocuslost.lua
index bc193a8..dea1e7c 100644
--- a/plugins/autosaveonfocuslost.lua
+++ b/plugins/autosaveonfocuslost.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local CommandView = require "core.commandview"
local DocView = require "core.docview"
diff --git a/plugins/autowrap.lua b/plugins/autowrap.lua
index 1d5d08d..38f8eb3 100644
--- a/plugins/autowrap.lua
+++ b/plugins/autowrap.lua
@@ -1,10 +1,10 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
require "plugins.reflow"
local config = require "core.config"
local command = require "core.command"
local DocView = require "core.docview"
-config.autowrap_files = { "%.md$", "%.txt$" }
+config.plugins.autowrap = { files = { "%.md$", "%.txt$" } }
local on_text_input = DocView.on_text_input
@@ -15,7 +15,7 @@ DocView.on_text_input = function(self, ...)
-- early-exit if the filename does not match a file type pattern
local filename = self.doc.filename or ""
local matched = false
- for _, ptn in ipairs(config.autowrap_files) do
+ for _, ptn in ipairs(config.plugins.autowrap.files) do
if filename:match(ptn) then
matched = true
break
diff --git a/plugins/bigclock.lua b/plugins/bigclock.lua
index ac44c9f..e77f336 100644
--- a/plugins/bigclock.lua
+++ b/plugins/bigclock.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local style = require "core.style"
local command = require "core.command"
@@ -7,9 +7,11 @@ local config = require "core.config"
local View = require "core.view"
-config.bigclock_time_format = "%H:%M:%S"
-config.bigclock_date_format = "%A, %d %B %Y"
-config.bigclock_scale = 1
+config.plugins.bigclock = {
+ time_format = "%H:%M:%S",
+ date_format = "%A, %d %B %Y"
+ scale = 1
+}
local ClockView = View:extend()
@@ -28,7 +30,7 @@ end
function ClockView:update_fonts()
- local size = math.floor(self.size.x * 0.15 / 15) * 15 * config.bigclock_scale
+ local size = math.floor(self.size.x * 0.15 / 15) * 15 * config.plugins.bigclock.scale
if self.font_size ~= size then
self.time_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", size)
self.date_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", size * 0.3)
@@ -40,8 +42,8 @@ end
function ClockView:update()
- local time_text = os.date(config.bigclock_time_format)
- local date_text = os.date(config.bigclock_date_format)
+ local time_text = os.date(config.plugins.bigclock.time_format)
+ local date_text = os.date(config.plugins.bigclock.date_format)
if self.time_text ~= time_text or self.date_text ~= date_text then
core.redraw = true
self.time_text = time_text
diff --git a/plugins/bracketmatch.lua b/plugins/bracketmatch.lua
index e6a740d..4d1da37 100644
--- a/plugins/bracketmatch.lua
+++ b/plugins/bracketmatch.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local style = require "core.style"
local command = require "core.command"
diff --git a/plugins/centerdoc.lua b/plugins/centerdoc.lua
index c60c2dd..a1cf5e3 100644
--- a/plugins/centerdoc.lua
+++ b/plugins/centerdoc.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local config = require "core.config"
local DocView = require "core.docview"
diff --git a/plugins/colorpreview.lua b/plugins/colorpreview.lua
index 370d1d8..5b16d28 100644
--- a/plugins/colorpreview.lua
+++ b/plugins/colorpreview.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local common = require "core.common"
local DocView = require "core.docview"
diff --git a/plugins/copyfilelocation.lua b/plugins/copyfilelocation.lua
index 9f33ee1..dedc188 100644
--- a/plugins/copyfilelocation.lua
+++ b/plugins/copyfilelocation.lua
@@ -1,8 +1,6 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
-local config = require "core.config"
-
command.add("core.docview", {
["copy-file-location:copy-file-location"] = function()
diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua
index 9ce425a..51d698e 100644
--- a/plugins/datetimestamps.lua
+++ b/plugins/datetimestamps.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local config = require "core.config"
local command = require "core.command"
@@ -25,32 +25,25 @@ from https://www.lua.org/pil/22.1.html
%y two-digit year (98) [00-99]
%% the character `%´
--]]
-config.datetimestamps_format_datestamp = "%Y%m%d"
-config.datetimestamps_format_datetimestamp = "%Y%m%d_%H%M%S"
-config.datetimestamps_format_timestamp = "%H%M%S"
+config.plugins.datetimestamps = {
+ format_datestamp = "%Y%m%d"
+ format_datetimestamp = "%Y%m%d_%H%M%S"
+ format_timestamp = "%H%M%S"
+}
local function datestamp()
-
- local sOut = os.date(config.datetimestamps_format_datestamp)
-
+ local sOut = os.date(config.plugins.datetimestamps.format_datestamp)
core.active_view.doc:text_input(sOut)
-
end
local function datetimestamp()
-
- local sOut = os.date(config.datetimestamps_format_datetimestamp)
-
+ local sOut = os.date(config.plugins.datetimestamps.format_datetimestamp)
core.active_view.doc:text_input(sOut)
-
end
local function timestamp()
-
- local sOut = os.date(config.datetimestamps_format_timestamp)
-
+ local sOut = os.date(config.plugins.datetimestamps.format_timestamp)
core.active_view.doc:text_input(sOut)
-
end
command.add("core.docview", {
diff --git a/plugins/dragdropselected.lua b/plugins/dragdropselected.lua
index aeacbd3..4dbaa84 100644
--- a/plugins/dragdropselected.lua
+++ b/plugins/dragdropselected.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
--[[
dragdropselected.lua
provides basic drag and drop of selected text (in same document)
diff --git a/plugins/ephemeraldocviews.lua b/plugins/ephemeraldocviews.lua
index 37b3a3b..cb9f53d 100644
--- a/plugins/ephemeraldocviews.lua
+++ b/plugins/ephemeraldocviews.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local RootView = require "core.rootview"
diff --git a/plugins/eval.lua b/plugins/eval.lua
index ae13a14..bd1ff56 100644
--- a/plugins/eval.lua
+++ b/plugins/eval.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
diff --git a/plugins/exec.lua b/plugins/exec.lua
index d1ed6a8..cf2d8f2 100644
--- a/plugins/exec.lua
+++ b/plugins/exec.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
diff --git a/plugins/ghmarkdown.lua b/plugins/ghmarkdown.lua
index 6e81daa..7dcf3cb 100644
--- a/plugins/ghmarkdown.lua
+++ b/plugins/ghmarkdown.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/gitstatus.lua b/plugins/gitstatus.lua
index 904cd38..b7ff5de 100644
--- a/plugins/gitstatus.lua
+++ b/plugins/gitstatus.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local config = require "core.config"
local style = require "core.style"
diff --git a/plugins/gofmt.lua b/plugins/gofmt.lua
index fd204a6..02c817b 100644
--- a/plugins/gofmt.lua
+++ b/plugins/gofmt.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/hidelinenumbers.lua b/plugins/hidelinenumbers.lua
index 5ed23b3..4494670 100644
--- a/plugins/hidelinenumbers.lua
+++ b/plugins/hidelinenumbers.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local style = require "core.style"
local DocView = require "core.docview"
diff --git a/plugins/hidestatus.lua b/plugins/hidestatus.lua
index fc687cb..6e63a81 100644
--- a/plugins/hidestatus.lua
+++ b/plugins/hidestatus.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local command = require "core.command"
local StatusView = require "core.statusview"
diff --git a/plugins/indentguide.lua b/plugins/indentguide.lua
index f1b7cf7..0513be4 100644
--- a/plugins/indentguide.lua
+++ b/plugins/indentguide.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local style = require "core.style"
local config = require "core.config"
local DocView = require "core.docview"
diff --git a/plugins/language_angelscript.lua b/plugins/language_angelscript.lua
index d34a0eb..d214ea0 100644
--- a/plugins/language_angelscript.lua
+++ b/plugins/language_angelscript.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_batch.lua b/plugins/language_batch.lua
index 441a367..b01c65d 100644
--- a/plugins/language_batch.lua
+++ b/plugins/language_batch.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
-- batch syntax for lite <liqube>
diff --git a/plugins/language_bib.lua b/plugins/language_bib.lua
index 08a5662..96c80c7 100644
--- a/plugins/language_bib.lua
+++ b/plugins/language_bib.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_cmake.lua b/plugins/language_cmake.lua
index 9f4df2f..34b4d0c 100644
--- a/plugins/language_cmake.lua
+++ b/plugins/language_cmake.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_cpp.lua b/plugins/language_cpp.lua
index bb1f347..f229134 100644
--- a/plugins/language_cpp.lua
+++ b/plugins/language_cpp.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
pcall(require, "plugins.language_c")
local syntax = require "core.syntax"
diff --git a/plugins/language_csharp.lua b/plugins/language_csharp.lua
index b6ee8e0..6bc6fcd 100644
--- a/plugins/language_csharp.lua
+++ b/plugins/language_csharp.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_d.lua b/plugins/language_d.lua
index a054de6..641aefa 100644
--- a/plugins/language_d.lua
+++ b/plugins/language_d.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_dart.lua b/plugins/language_dart.lua
index 2e3cfc3..01bdc97 100644
--- a/plugins/language_dart.lua
+++ b/plugins/language_dart.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_elixir.lua b/plugins/language_elixir.lua
index 8dd7cc9..e4919da 100644
--- a/plugins/language_elixir.lua
+++ b/plugins/language_elixir.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_elm.lua b/plugins/language_elm.lua
index c5f2223..4038420 100644
--- a/plugins/language_elm.lua
+++ b/plugins/language_elm.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_fe.lua b/plugins/language_fe.lua
index f1aeef4..c852124 100644
--- a/plugins/language_fe.lua
+++ b/plugins/language_fe.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_fennel.lua b/plugins/language_fennel.lua
index fbf1ba6..de229f1 100644
--- a/plugins/language_fennel.lua
+++ b/plugins/language_fennel.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- Support for the Fennel programming language: https://fennel-lang.org
-- Covers all the keywords up to Fennel version 0.4.0
diff --git a/plugins/language_gdscript.lua b/plugins/language_gdscript.lua
index c638ab9..5a29b97 100644
--- a/plugins/language_gdscript.lua
+++ b/plugins/language_gdscript.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- Support for the GDScript programming language: https://godotengine.org/
-- Covers the most used keywords up to Godot version 3.2.x
diff --git a/plugins/language_glsl.lua b/plugins/language_glsl.lua
index 1f57a06..36ceb03 100644
--- a/plugins/language_glsl.lua
+++ b/plugins/language_glsl.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local style = require "core.style"
local common = require "core.common"
diff --git a/plugins/language_go.lua b/plugins/language_go.lua
index 76289bd..8c8900e 100644
--- a/plugins/language_go.lua
+++ b/plugins/language_go.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_hlsl.lua b/plugins/language_hlsl.lua
index 45128d6..0aedab0 100644
--- a/plugins/language_hlsl.lua
+++ b/plugins/language_hlsl.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local style = require "core.style"
local common = require "core.common"
diff --git a/plugins/language_hs.lua b/plugins/language_hs.lua
index 5f69a5a..5530f87 100644
--- a/plugins/language_hs.lua
+++ b/plugins/language_hs.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_java.lua b/plugins/language_java.lua
index 42ad147..8c6e98e 100644
--- a/plugins/language_java.lua
+++ b/plugins/language_java.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_jiyu.lua b/plugins/language_jiyu.lua
index a433170..c30cd00 100644
--- a/plugins/language_jiyu.lua
+++ b/plugins/language_jiyu.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_jsx.lua b/plugins/language_jsx.lua
index 2648c68..328e2db 100644
--- a/plugins/language_jsx.lua
+++ b/plugins/language_jsx.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- Almost identical to JS, with the exception that / shouldn't denote a regex. Current JS syntax highlighter will highlight half the document due to closing tags.
local syntax = require "core.syntax"
diff --git a/plugins/language_liquid.lua b/plugins/language_liquid.lua
index 5cc7573..ffb2c96 100644
--- a/plugins/language_liquid.lua
+++ b/plugins/language_liquid.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
local liquid_syntax = {
diff --git a/plugins/language_make.lua b/plugins/language_make.lua
index 21e9df0..4ce5d00 100644
--- a/plugins/language_make.lua
+++ b/plugins/language_make.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_meson.lua b/plugins/language_meson.lua
index c1aa4b1..02763a7 100644
--- a/plugins/language_meson.lua
+++ b/plugins/language_meson.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_moon.lua b/plugins/language_moon.lua
index ef8d3bd..6b5f9d2 100644
--- a/plugins/language_moon.lua
+++ b/plugins/language_moon.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_nim.lua b/plugins/language_nim.lua
index d42cb4a..c9f3355 100644
--- a/plugins/language_nim.lua
+++ b/plugins/language_nim.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
local patterns = {}
diff --git a/plugins/language_objc.lua b/plugins/language_objc.lua
index c2b2eee..c0ef95e 100644
--- a/plugins/language_objc.lua
+++ b/plugins/language_objc.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_odin.lua b/plugins/language_odin.lua
index 52a24e0..29d9868 100644
--- a/plugins/language_odin.lua
+++ b/plugins/language_odin.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_perl.lua b/plugins/language_perl.lua
index 1332464..cf60849 100644
--- a/plugins/language_perl.lua
+++ b/plugins/language_perl.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_php.lua b/plugins/language_php.lua
index 0db81a3..4f107aa 100644
--- a/plugins/language_php.lua
+++ b/plugins/language_php.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
--[[
language_php.lua
provides php syntax support allowing mixed html, css and js
diff --git a/plugins/language_phps.lua b/plugins/language_phps.lua
index 7476a8f..082b962 100644
--- a/plugins/language_phps.lua
+++ b/plugins/language_phps.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
--[[
language_phps.lua
complement to language_php.lua providing the php syntax support
diff --git a/plugins/language_pico8.lua b/plugins/language_pico8.lua
index c8ba027..b8b790e 100644
--- a/plugins/language_pico8.lua
+++ b/plugins/language_pico8.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_po.lua b/plugins/language_po.lua
index 0f07d40..54783ea 100644
--- a/plugins/language_po.lua
+++ b/plugins/language_po.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_powershell.lua b/plugins/language_powershell.lua
index 6cd0968..022170d 100644
--- a/plugins/language_powershell.lua
+++ b/plugins/language_powershell.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_psql.lua b/plugins/language_psql.lua
index 389f32a..09db99b 100644
--- a/plugins/language_psql.lua
+++ b/plugins/language_psql.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
-- In sql symbols can be lower case and upper case
diff --git a/plugins/language_ruby.lua b/plugins/language_ruby.lua
index 9661b1b..8b9bf33 100644
--- a/plugins/language_ruby.lua
+++ b/plugins/language_ruby.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_rust.lua b/plugins/language_rust.lua
index 4d0fef1..ac25305 100644
--- a/plugins/language_rust.lua
+++ b/plugins/language_rust.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_sass.lua b/plugins/language_sass.lua
index 8e0b43e..aa11637 100644
--- a/plugins/language_sass.lua
+++ b/plugins/language_sass.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua
index 684b070..f21557d 100644
--- a/plugins/language_sh.lua
+++ b/plugins/language_sh.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_tcl.lua b/plugins/language_tcl.lua
index 31efa84..a934777 100644
--- a/plugins/language_tcl.lua
+++ b/plugins/language_tcl.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_teal.lua b/plugins/language_teal.lua
index 5b46fd8..f64c419 100644
--- a/plugins/language_teal.lua
+++ b/plugins/language_teal.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_tex.lua b/plugins/language_tex.lua
index 3f9a5fa..1bc08f5 100644
--- a/plugins/language_tex.lua
+++ b/plugins/language_tex.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_ts.lua b/plugins/language_ts.lua
index 96cf0d3..1b322ed 100644
--- a/plugins/language_ts.lua
+++ b/plugins/language_ts.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- copied from language_js, but added regex highlighting back
local syntax = require "core.syntax"
diff --git a/plugins/language_tsx.lua b/plugins/language_tsx.lua
index 9dd93ad..63eef55 100644
--- a/plugins/language_tsx.lua
+++ b/plugins/language_tsx.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- Almost identical to JS, with the exception that / shouldn't denote a regex. Current JS syntax highlighter will highlight half the document due to closing tags.
local syntax = require "core.syntax"
diff --git a/plugins/language_v.lua b/plugins/language_v.lua
index 2a580c6..774617a 100644
--- a/plugins/language_v.lua
+++ b/plugins/language_v.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_wren.lua b/plugins/language_wren.lua
index 62ee24f..c4a6905 100644
--- a/plugins/language_wren.lua
+++ b/plugins/language_wren.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_yaml.lua b/plugins/language_yaml.lua
index 40e19b6..c86f733 100644
--- a/plugins/language_yaml.lua
+++ b/plugins/language_yaml.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_zig.lua b/plugins/language_zig.lua
index 3b4c953..4629e89 100644
--- a/plugins/language_zig.lua
+++ b/plugins/language_zig.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua
index f03d9af..5f4148b 100644
--- a/plugins/lfautoinsert.lua
+++ b/plugins/lfautoinsert.lua
@@ -1,11 +1,11 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local common = require "core.common"
local config = require "core.config"
local keymap = require "core.keymap"
-config.lfautoinsert_map = {
+config.plugins.lfautoinsert = { map = {
["{%s*\n"] = "}",
["%(%s*\n"] = ")",
["%f[[]%[%s*\n"] = "]",
@@ -37,11 +37,11 @@ config.lfautoinsert_map = {
["%[%[%s*\n"] = "]]"
}
},
-}
+} }
local function get_autoinsert_map(filename)
local map = {}
- for pattern, closing in pairs(config.lfautoinsert_map) do
+ for pattern, closing in pairs(config.plugins.lfautoinsert.map) do
if type(closing) == "table" then
if common.match_pattern(filename, closing.file_patterns) then
for p, e in pairs(closing.map) do
@@ -102,7 +102,7 @@ keymap.add {
return {
add = function(file_patterns, map)
table.insert(
- config.lfautoinsert_map,
+ config.plugins.lfautoinsert.map,
{ file_patterns = file_patterns, map=map }
)
end
diff --git a/plugins/linecopypaste.lua b/plugins/linecopypaste.lua
index a4a5e60..d332cc1 100755
--- a/plugins/linecopypaste.lua
+++ b/plugins/linecopypaste.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
diff --git a/plugins/lineguide.lua b/plugins/lineguide.lua
deleted file mode 100644
index 2cf0b42..0000000
--- a/plugins/lineguide.lua
+++ /dev/null
@@ -1,21 +0,0 @@
--- mod-version:1 -- lite-xl 1.16
-local config = require "core.config"
-local style = require "core.style"
-local DocView = require "core.docview"
-
-local draw = DocView.draw
-
-function DocView:draw(...)
- draw(self, ...)
-
- local ns = ("n"):rep(config.line_limit)
- local ss = self:get_font():subpixel_scale()
- local offset = self:get_font():get_width_subpixel(ns) / ss
- local x = self:get_line_screen_position(1) + offset
- local y = self.position.y
- local w = math.ceil(SCALE * 1)
- local h = self.size.y
-
- local color = style.guide or style.selection
- renderer.draw_rect(x, y, w, h, color)
-end
diff --git a/plugins/macmodkeys.lua b/plugins/macmodkeys.lua
index 14f8995..d8c0d05 100644
--- a/plugins/macmodkeys.lua
+++ b/plugins/macmodkeys.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local keymap = require "core.keymap"
local on_key_pressed = keymap.on_key_pressed
diff --git a/plugins/markers.lua b/plugins/markers.lua
index f4a70d6..e09fa3d 100644
--- a/plugins/markers.lua
+++ b/plugins/markers.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- Markers plugin for lite text editor
-- original implementation by Petri Häkkinen
diff --git a/plugins/memoryusage.lua b/plugins/memoryusage.lua
index ee472dd..fcdcc29 100644
--- a/plugins/memoryusage.lua
+++ b/plugins/memoryusage.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- original implementation by AqilCont
local style = require "core.style"
local StatusView = require "core.statusview"
diff --git a/plugins/minimap.lua b/plugins/minimap.lua
index ecae5eb..01f93c5 100644
--- a/plugins/minimap.lua
+++ b/plugins/minimap.lua
@@ -6,26 +6,26 @@ local style = require "core.style"
local DocView = require "core.docview"
-- General plugin settings
-config.minimap_enabled = true
-config.minimap_width = 100
-config.minimap_instant_scroll = false
-config.minimap_syntax_highlight = true
-config.minimap_scale = 1
-
--- how many spaces one tab is equivalent to
-config.minimap_tab_width = 4
-
-config.minimap_draw_background = true
+config.plugins.minimap = {
+ enabled = true,
+ width = 100,
+ instant_scroll = false,
+ syntax_highlight = true,
+ scale = 1,
+ -- how many spaces one tab is equivalent to
+ tab_width = 4,
+ draw_background = true
+}
-- Configure size for rendering each char in the minimap
-local char_height = 1 * SCALE * config.minimap_scale
-local char_spacing = 0.8 * SCALE * config.minimap_scale
-local line_spacing = 2 * SCALE * config.minimap_scale
+local char_height = 1 * SCALE * config.plugins.minimap.scale
+local char_spacing = 0.8 * SCALE * config.plugins.minimap.scale
+local line_spacing = 2 * SCALE * config.plugins.minimap.scale
-- Overloaded since the default implementation adds a extra x3 size of hotspot for the mouse to hit the scrollbar.
local prev_scrollbar_overlaps_point = DocView.scrollbar_overlaps_point
DocView.scrollbar_overlaps_point = function(self, x, y)
- if not config.minimap_enabled then
+ if not config.plugins.minimap.enabled then
return prev_scrollbar_overlaps_point(self, x, y)
end
@@ -46,7 +46,7 @@ end
-- Overloaded with an extra check if the user clicked inside the minimap to automatically scroll to that line.
local prev_on_mouse_pressed = DocView.on_mouse_pressed
DocView.on_mouse_pressed = function(self, button, x, y, clicks)
- if not config.minimap_enabled then
+ if not config.plugins.minimap.enabled then
return prev_on_mouse_pressed(self, button, x, y, clicks)
end
@@ -100,7 +100,7 @@ DocView.on_mouse_pressed = function(self, button, x, y, clicks)
-- if user didn't click on the visible area (ie not dragging), scroll accordingly
if not hit_visible_area then
- self:scroll_to_line(jump_to_line, false, config.minimap_instant_scroll)
+ self:scroll_to_line(jump_to_line, false, config.plugins.minimap.instant_scroll)
return
end
@@ -114,7 +114,7 @@ end
-- since the "scrollbar" essentially represents the lines visible in the content view.
local prev_on_mouse_moved = DocView.on_mouse_moved
DocView.on_mouse_moved = function(self, x, y, dx, dy)
- if not config.minimap_enabled then
+ if not config.plugins.minimap.enabled then
return prev_on_mouse_moved(self, x, y, dx, dy)
end
@@ -143,16 +143,16 @@ end
-- not juse the scrollbar.
local prev_get_scrollbar_rect = DocView.get_scrollbar_rect
DocView.get_scrollbar_rect = function(self)
- if not config.minimap_enabled then return prev_get_scrollbar_rect(self) end
+ if not config.plugins.minimap.enabled then return prev_get_scrollbar_rect(self) end
- return self.position.x + self.size.x - config.minimap_width * SCALE,
- self.position.y, config.minimap_width * SCALE, self.size.y
+ return self.position.x + self.size.x - config.plugins.minimap.width * SCALE,
+ self.position.y, config.plugins.minimap.width * SCALE, self.size.y
end
-- Overloaded so we can render the minimap in the "scrollbar area".
local prev_draw_scrollbar = DocView.draw_scrollbar
DocView.draw_scrollbar = function(self)
- if not config.minimap_enabled then return prev_draw_scrollbar(self) end
+ if not config.plugins.minimap.enabled then return prev_draw_scrollbar(self) end
local x, y, w, h = self:get_scrollbar_rect()
@@ -190,7 +190,7 @@ DocView.draw_scrollbar = function(self)
line_count - max_minmap_lines))
end
- if config.minimap_draw_background then
+ if config.plugins.minimap.draw_background then
renderer.draw_rect(x, y, w, h, style.minimap_background or style.background)
end
-- draw visual rect
@@ -206,12 +206,12 @@ DocView.draw_scrollbar = function(self)
-- we try to "batch" characters so that they can be rendered as just one rectangle instead of one for each.
local batch_width = 0
local batch_start = x
- local minimap_cutoff_x = x + config.minimap_width * SCALE
+ local minimap_cutoff_x = x + config.plugins.minimap.width * SCALE
local batch_syntax_type = nil
local function flush_batch(type)
local old_color = color
color = style.syntax[batch_syntax_type]
- if config.minimap_syntax_highlight and color ~= nil then
+ if config.plugins.minimap.syntax_highlight and color ~= nil then
-- fetch and dim colors
color = {color[1], color[2], color[3], color[4] * 0.5}
else
@@ -226,7 +226,7 @@ DocView.draw_scrollbar = function(self)
end
-- render lines with syntax highlighting
- if config.minimap_syntax_highlight then
+ if config.plugins.minimap.syntax_highlight then
-- keep track of the highlight type, since this needs to break batches as well
batch_syntax_type = nil
@@ -252,7 +252,7 @@ DocView.draw_scrollbar = function(self)
batch_start = batch_start + char_spacing
elseif char == " " then
flush_batch(type)
- batch_start = batch_start + (char_spacing * config.minimap_tab_width)
+ batch_start = batch_start + (char_spacing * config.plugins.minimap.tab_width)
elseif batch_start + batch_width > minimap_cutoff_x then
flush_batch(type)
break
@@ -291,9 +291,9 @@ end
command.add(nil, {
["minimap:toggle-visibility"] = function()
- config.minimap_enabled = not config.minimap_enabled
+ config.plugins.minimap.enabled = not config.plugins.minimap.enabled
end,
["minimap:toggle-syntax-highlighting"] = function()
- config.minimap_syntax_highlight = not config.minimap_syntax_highlight
+ config.plugins.minimap.syntax_highlight = not config.plugins.minimap.syntax_highlight
end
})
diff --git a/plugins/motiontrail.lua b/plugins/motiontrail.lua
index 6f448bb..1359c90 100644
--- a/plugins/motiontrail.lua
+++ b/plugins/motiontrail.lua
@@ -1,10 +1,10 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local config = require "core.config"
local style = require "core.style"
local DocView = require "core.docview"
-config.motiontrail_steps = 50
+config.plugins.motiontrail = { steps = 50 }
local function lerp(a, b, t)
@@ -32,7 +32,7 @@ function DocView:draw(...)
if last_view == self and (x ~= last_x or y ~= last_y) then
local lx = x
- for i = 0, 1, 1 / config.motiontrail_steps do
+ for i = 0, 1, 1 / config.plugins.motiontrail.steps do
local ix = lerp(x, last_x, i)
local iy = lerp(y, last_y, i)
local iw = math.max(w, math.ceil(math.abs(ix - lx)))
diff --git a/plugins/navigate.lua b/plugins/navigate.lua
index dd985b5..4e6092f 100644
--- a/plugins/navigate.lua
+++ b/plugins/navigate.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local common = require "core.common"
diff --git a/plugins/openfilelocation.lua b/plugins/openfilelocation.lua
index 48877bd..4b89815 100644
--- a/plugins/openfilelocation.lua
+++ b/plugins/openfilelocation.lua
@@ -1,15 +1,16 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local config = require "core.config"
+config.plugins.openfilelocation = {}
if PLATFORM == "Windows" then
- config.filemanager = "explorer"
+ config.plugins.openfilelocation.filemanager = "explorer"
elseif PLATFORM == "Mac OS X" then
- config.filemanager = "open"
+ config.plugins.openfilelocation.filemanager = "open"
else
- config.filemanager = "xdg-open"
+ config.plugins.openfilelocation.filemanager = "xdg-open"
end
@@ -23,9 +24,9 @@ command.add("core.docview", {
local folder = doc.filename:match("^(.*)[/\\].*$") or "."
core.log("Opening \"%s\"", folder)
if PLATFORM == "Windows" then
- system.exec(string.format("%s %s", config.filemanager, folder))
+ system.exec(string.format("%s %s", config.plugins.openfilelocation.filemanager, folder))
else
- system.exec(string.format("%s %q", config.filemanager, folder))
+ system.exec(string.format("%s %q", config.plugins.openfilelocation.filemanager, folder))
end
end
})
diff --git a/plugins/openselected.lua b/plugins/openselected.lua
index ccaa8e3..a1e21a2 100644
--- a/plugins/openselected.lua
+++ b/plugins/openselected.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/pdfview.lua b/plugins/pdfview.lua
index 743c6ec..d5d749a 100644
--- a/plugins/pdfview.lua
+++ b/plugins/pdfview.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/rainbowparen.lua b/plugins/rainbowparen.lua
index b6075ac..52e9d50 100644
--- a/plugins/rainbowparen.lua
+++ b/plugins/rainbowparen.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local tokenizer = require "core.tokenizer"
local style = require "core.style"
local common = require "core.common"
diff --git a/plugins/regexreplacepreview.lua b/plugins/regexreplacepreview.lua
index 926530b..1c8b845 100644
--- a/plugins/regexreplacepreview.lua
+++ b/plugins/regexreplacepreview.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local keymap = require "core.keymap"
local command = require "core.command"
diff --git a/plugins/restoretabs.lua b/plugins/restoretabs.lua
index 6776e2c..5bcd977 100644
--- a/plugins/restoretabs.lua
+++ b/plugins/restoretabs.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
-- Not perfect, because we can't actually figure out when something closes, but should be good enough, so long as we check the list of open views.
-- Maybe find a better way to get at "Node"?
local core = require "core"
diff --git a/plugins/scale.lua b/plugins/scale.lua
deleted file mode 100644
index 14648fd..0000000
--- a/plugins/scale.lua
+++ /dev/null
@@ -1,142 +0,0 @@
--- mod-version:1 -- lite-xl 1.16
-local core = require "core"
-local common = require "core.common"
-local command = require "core.command"
-local config = require "core.config"
-local keymap = require "core.keymap"
-local style = require "core.style"
-local RootView = require "core.rootview"
-local CommandView = require "core.commandview"
-
-config.scale_mode = "code"
-config.scale_use_mousewheel = true
-
-local scale_level = 0
-local scale_steps = 0.1
-local font_cache = setmetatable({}, { __mode = "k" })
-
--- default lite fonts
-local regular_font = "font.ttf"
-local monospace_font = "monospace.ttf"
-
--- Set font names properly to work with latest lite-xl changes
-if io.open(DATADIR .. "/fonts/FiraSans-Regular.ttf", "r") then
- regular_font = "FiraSans-Regular.ttf"
-end
-
-if io.open(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", "r") then
- monospace_font = "JetBrainsMono-Regular.ttf"
-end
-
--- the following should be kept in sync with core.style's default font settings
-font_cache[style.font] = { DATADIR .. "/fonts/" .. regular_font, 13 * SCALE }
-font_cache[style.big_font] = { DATADIR .. "/fonts/" .. regular_font, 40 * SCALE }
-font_cache[style.icon_font] = { DATADIR .. "/fonts/icons.ttf", 14 * SCALE }
-font_cache[style.icon_big_font] = { DATADIR .. "/fonts/icons.ttf", 20 * SCALE }
-font_cache[style.code_font] = { DATADIR .. "/fonts/" .. monospace_font, 13 * SCALE }
-
-
-local load_font = renderer.font.load
-function renderer.font.load(...)
- local res = load_font(...)
- font_cache[res] = { ... }
- return res
-end
-
-
-local function scale_font(font, s)
- local fc = font_cache[font]
- return renderer.font.load(fc[1], fc[2] * s)
-end
-
-
-local current_scale = SCALE
-local default = current_scale
-
-
-local function get_scale() return current_scale end
-
-
-local function set_scale(scale)
- scale = common.clamp(scale, 0.2, 6)
-
- -- save scroll positions
- local scrolls = {}
- for _, view in ipairs(core.root_view.root_node:get_children()) do
- local n = view:get_scrollable_size()
- if n ~= math.huge and not view:is(CommandView) and n > view.size.y then
- scrolls[view] = view.scroll.y / (n - view.size.y)
- end
- end
-
- local s = scale / current_scale
- current_scale = scale
-
- if config.scale_mode == "ui" then
- SCALE = current_scale
-
- style.padding.x = style.padding.x * s
- style.padding.y = style.padding.y * s
- style.divider_size = style.divider_size * s
- style.scrollbar_size = style.scrollbar_size * s
- style.caret_width = style.caret_width * s
- style.tab_width = style.tab_width * s
-
- style.big_font = scale_font(style.big_font, s)
- style.icon_font = scale_font(style.icon_font, s)
- style.font = scale_font(style.font, s)
- end
-
- style.code_font = scale_font(style.code_font, s)
-
- -- restore scroll positions
- for view, n in pairs(scrolls) do
- view.scroll.y = n * (view:get_scrollable_size() - view.size.y)
- view.scroll.to.y = view.scroll.y
- end
-
- core.redraw = true
-end
-
-
-local on_mouse_wheel = RootView.on_mouse_wheel
-
-function RootView:on_mouse_wheel(d, ...)
- if keymap.modkeys["ctrl"] and config.scale_use_mousewheel then
- if d < 0 then command.perform "scale:decrease" end
- if d > 0 then command.perform "scale:increase" end
- else
- return on_mouse_wheel(self, d, ...)
- end
-end
-
-local function res_scale()
- scale_level = 0
- set_scale(default)
-end
-
-local function inc_scale()
- scale_level = scale_level + 1
- set_scale(default + scale_level * scale_steps)
-end
-
-local function dec_scale()
- scale_level = scale_level - 1
- set_scale(default + scale_level * scale_steps)
-end
-
-
-command.add(nil, {
- ["scale:reset" ] = function() res_scale() end,
- ["scale:decrease"] = function() dec_scale() end,
- ["scale:increase"] = function() inc_scale() end,
-})
-
-keymap.add {
- ["ctrl+0"] = "scale:reset",
- ["ctrl+-"] = "scale:decrease",
- ["ctrl+="] = "scale:increase",
-}
-
-return { get_scale = get_scale, set_scale = set_scale }
-
diff --git a/plugins/scalestatus.lua b/plugins/scalestatus.lua
index 2981523..8f3ef68 100644
--- a/plugins/scalestatus.lua
+++ b/plugins/scalestatus.lua
@@ -1,24 +1,16 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
--[[
scalestatus.lua
displays current scale (zoom) in status view
version: 20200628_155804
originally by SwissalpS
-
- Depends on plugin scale.lua version >= 20200628_154010
--]]
local scale = require "plugins.scale"
--- make sure plugin is installed and has get_scale field
-if not scale.get_scale then
- local core = require "core"
- core.error("Plugin 'scale' needs to be updated, scalestatus inactive.")
- return false
-end
local config = require "core.config"
local StatusView = require "core.statusview"
-config.scalestatus_format = '%.0f%%'
+config.plugins.scalestatus = { format = '%.0f%%' }
local get_items = StatusView.get_items
function StatusView:get_items()
@@ -27,7 +19,7 @@ function StatusView:get_items()
local t = {
self.separator,
- string.format(config.scalestatus_format, scale.get_scale() * 100),
+ string.format(config.plugins.scalestatus.format, scale.get() * 100),
}
for _, item in ipairs(t) do
diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua
index 93ac0fb..1cec783 100644
--- a/plugins/selectionhighlight.lua
+++ b/plugins/selectionhighlight.lua
@@ -1,7 +1,6 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local style = require "core.style"
local DocView = require "core.docview"
-local config = require "core.config"
-- originally written by luveti
diff --git a/plugins/smallclock.lua b/plugins/smallclock.lua
index 5c76160..b22bc71 100644
--- a/plugins/smallclock.lua
+++ b/plugins/smallclock.lua
@@ -1,4 +1,4 @@
--- lite-xl 1.16
+-- lite-xl 2.00
local core = require "core"
local style = require "core.style"
local status_view = require "core.statusview"
diff --git a/plugins/sort.lua b/plugins/sort.lua
index 34b2b93..fd9d044 100644
--- a/plugins/sort.lua
+++ b/plugins/sort.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local translate = require "core.doc.translate"
diff --git a/plugins/spellcheck.lua b/plugins/spellcheck.lua
index 975ef91..db58606 100644
--- a/plugins/spellcheck.lua
+++ b/plugins/spellcheck.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local style = require "core.style"
local config = require "core.config"
@@ -7,11 +7,12 @@ local common = require "core.common"
local DocView = require "core.docview"
local Doc = require "core.doc"
-config.spellcheck_files = { "%.txt$", "%.md$", "%.markdown$" }
+config.plugins.spellcheck = {}
+config.spellcheck.files = { "%.txt$", "%.md$", "%.markdown$" }
if PLATFORM == "Windows" then
- config.dictionary_file = EXEDIR .. "/words.txt"
+ config.plugins.spellcheck.dictionary_file = EXEDIR .. "/words.txt"
else
- config.dictionary_file = "/usr/share/dict/words"
+ config.plugins.spellcheck.dictionary_file = "/usr/share/dict/words"
end
@@ -22,7 +23,7 @@ local words
core.add_thread(function()
local t = {}
local i = 0
- for line in io.lines(config.dictionary_file) do
+ for line in io.lines(config.plugins.spellcheck.dictionary_file) do
for word in line:gmatch(word_pattern) do
t[word:lower()] = true
end
@@ -31,7 +32,7 @@ core.add_thread(function()
end
words = t
core.redraw = true
- core.log_quiet("Finished loading dictionary file: \"%s\"", config.dictionary_file)
+ core.log_quiet("Finished loading dictionary file: \"%s\"", config.plugins.spellcheck.dictionary_file)
end)
@@ -64,7 +65,7 @@ function DocView:draw_line_text(idx, x, y)
draw_line_text(self, idx, x, y)
if not words
- or not matches_any(self.doc.filename or "", config.spellcheck_files) then
+ or not matches_any(self.doc.filename or "", config.plugins.spellcheck.files) then
return
end
@@ -120,7 +121,7 @@ command.add("core.docview", {
return
end
if word then
- local fp = assert(io.open(config.dictionary_file, "a"))
+ local fp = assert(io.open(config.plugins.spellcheck.dictionary_file, "a"))
fp:write("\n" .. word .. "\n")
fp:close()
words[word] = true
diff --git a/plugins/tabnumbers.lua b/plugins/tabnumbers.lua
index 70da707..581a6b2 100644
--- a/plugins/tabnumbers.lua
+++ b/plugins/tabnumbers.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local common = require "core.common"
local core = require "core"
local style = require "core.style"
diff --git a/plugins/texcompile.lua b/plugins/texcompile.lua
index 7a5fd6e..2f53513 100644
--- a/plugins/texcompile.lua
+++ b/plugins/texcompile.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/themeselect.lua b/plugins/themeselect.lua
index cafc1be..70bd627 100644
--- a/plugins/themeselect.lua
+++ b/plugins/themeselect.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
-- Load a specific theme when the filename of an active document does match
diff --git a/plugins/titleize.lua b/plugins/titleize.lua
index ac64f44..edb50d2 100644
--- a/plugins/titleize.lua
+++ b/plugins/titleize.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
diff --git a/plugins/togglesnakecamel.lua b/plugins/togglesnakecamel.lua
index 0ba3ce9..b5d20d9 100644
--- a/plugins/togglesnakecamel.lua
+++ b/plugins/togglesnakecamel.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/unboundedscroll.lua b/plugins/unboundedscroll.lua
index 18d26a2..a27ab25 100644
--- a/plugins/unboundedscroll.lua
+++ b/plugins/unboundedscroll.lua
@@ -1,4 +1,4 @@
--- mod-version:1 -- lite-xl 1.16
+-- mod-version:2 -- lite-xl 2.0
local DocView = require "core.docview"
function DocView.clamp_scroll_position()