From c569b3b3697c1656c78ec4b4d233d4ed78fa898a Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sun, 5 Dec 2021 22:44:43 -0500 Subject: Bumping versions. --- plugins/autoinsert.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/autoinsert.lua') diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index 638d6cc..d0b8404 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -1,4 +1,4 @@ --- mod-version:2 -- lite-xl 2.0 +-- mod-version:3 --lite-xl 2.1 local core = require "core" local translate = require "core.doc.translate" local config = require "core.config" -- cgit v1.2.3 From 3fcf065be6387c5bb38a46924f5ea1a7bb17850d Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sun, 5 Dec 2021 22:56:04 -0500 Subject: Appropriately merged config hashes. --- plugins/autoinsert.lua | 5 +++-- plugins/autosave.lua | 3 ++- plugins/autowrap.lua | 2 +- plugins/bigclock.lua | 4 ++-- plugins/datetimestamps.lua | 5 +++-- plugins/fontconfig.lua | 3 ++- plugins/indent_convert.lua | 5 +++-- plugins/lfautoinsert.lua | 4 ++-- plugins/minimap.lua | 4 ++-- plugins/motiontrail.lua | 3 ++- plugins/openfilelocation.lua | 15 ++++++++------- plugins/openselected.lua | 16 +++++++++------- plugins/scalestatus.lua | 4 ++-- plugins/smoothcaret.lua | 3 ++- plugins/spellcheck.lua | 12 ++++-------- plugins/statusclock.lua | 5 +++-- 16 files changed, 50 insertions(+), 43 deletions(-) (limited to 'plugins/autoinsert.lua') 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 = '', -- cgit v1.2.3 From d30a72bdb1dd815461745122c5a3523d1824c381 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 31 May 2022 16:25:02 -0400 Subject: removed lite-xl version and left only mod version --- plugins/autoinsert.lua | 2 +- plugins/autosave.lua | 2 +- plugins/autosaveonfocuslost.lua | 2 +- plugins/autowrap.lua | 2 +- plugins/bigclock.lua | 2 +- plugins/bracketmatch.lua | 2 +- plugins/centerdoc.lua | 2 +- plugins/colorpreview.lua | 2 +- plugins/copyfilelocation.lua | 2 +- plugins/datetimestamps.lua | 2 +- plugins/dragdropselected.lua | 2 +- plugins/ephemeral_tabs.lua | 2 +- plugins/eval.lua | 2 +- plugins/exec.lua | 2 +- plugins/extend_selection_line.lua | 2 +- plugins/fontconfig.lua | 2 +- plugins/force_syntax.lua | 2 +- plugins/ghmarkdown.lua | 2 +- plugins/gitstatus.lua | 2 +- plugins/gofmt.lua | 2 +- plugins/indent_convert.lua | 2 +- plugins/indentguide.lua | 2 +- plugins/language_R.lua | 4 +- plugins/language_angelscript.lua | 2 +- plugins/language_batch.lua | 2 +- plugins/language_bib.lua | 2 +- plugins/language_cmake.lua | 2 +- plugins/language_cpp.lua | 2 +- plugins/language_crystal.lua | 2 +- plugins/language_csharp.lua | 2 +- plugins/language_d.lua | 2 +- plugins/language_dart.lua | 2 +- plugins/language_diff.lua | 2 +- plugins/language_elixir.lua | 2 +- plugins/language_elm.lua | 2 +- plugins/language_fe.lua | 2 +- plugins/language_fennel.lua | 2 +- plugins/language_fstab.lua | 6 +- plugins/language_gdscript.lua | 2 +- plugins/language_glsl.lua | 2 +- plugins/language_gmi.lua | 2 +- plugins/language_go.lua | 2 +- plugins/language_hlsl.lua | 2 +- plugins/language_hs.lua | 2 +- plugins/language_ini.lua | 2 +- plugins/language_java.lua | 2 +- plugins/language_jiyu.lua | 2 +- plugins/language_jsx.lua | 2 +- plugins/language_julia.lua | 2 +- plugins/language_liquid.lua | 28 +++++----- plugins/language_lobster.lua | 6 +- plugins/language_make.lua | 2 +- plugins/language_meson.lua | 2 +- plugins/language_moon.lua | 2 +- plugins/language_nginx.lua | 2 +- plugins/language_nim.lua | 2 +- plugins/language_objc.lua | 2 +- plugins/language_odin.lua | 2 +- plugins/language_perl.lua | 2 +- plugins/language_php.lua | 2 +- plugins/language_pico8.lua | 2 +- plugins/language_pkgbuild.lua | 2 +- plugins/language_po.lua | 2 +- plugins/language_powershell.lua | 2 +- plugins/language_psql.lua | 2 +- plugins/language_rescript.lua | 2 +- plugins/language_rivet.lua | 2 +- plugins/language_ruby.lua | 2 +- plugins/language_rust.lua | 2 +- plugins/language_sass.lua | 2 +- plugins/language_scala.lua | 114 +++++++++++++++++++------------------- plugins/language_sh.lua | 2 +- plugins/language_ssh_config.lua | 2 +- plugins/language_tcl.lua | 2 +- plugins/language_teal.lua | 2 +- plugins/language_tex.lua | 2 +- plugins/language_toml.lua | 2 +- plugins/language_ts.lua | 2 +- plugins/language_tsx.lua | 5 +- plugins/language_v.lua | 2 +- plugins/language_wren.lua | 2 +- plugins/language_yaml.lua | 2 +- plugins/language_zig.lua | 2 +- plugins/lfautoinsert.lua | 2 +- plugins/linecopypaste.lua | 2 +- plugins/linenumbers.lua | 2 +- plugins/macmodkeys.lua | 2 +- plugins/markers.lua | 2 +- plugins/memoryusage.lua | 2 +- plugins/minimap.lua | 2 +- plugins/motiontrail.lua | 2 +- plugins/navigate.lua | 2 +- plugins/nonicons.lua | 2 +- plugins/opacity.lua | 2 +- plugins/open_ext.lua | 2 +- plugins/openfilelocation.lua | 2 +- plugins/openselected.lua | 2 +- plugins/pdfview.lua | 2 +- plugins/rainbowparen.lua | 2 +- plugins/regexreplacepreview.lua | 2 +- plugins/restoretabs.lua | 2 +- plugins/scalestatus.lua | 2 +- plugins/select_colorscheme.lua | 2 +- plugins/selectionhighlight.lua | 2 +- plugins/settings.lua | 2 +- plugins/smallclock.lua | 2 +- plugins/smoothcaret.lua | 2 +- plugins/sort.lua | 2 +- plugins/spellcheck.lua | 2 +- plugins/statusclock.lua | 2 +- plugins/tabnumbers.lua | 2 +- plugins/texcompile.lua | 2 +- plugins/themeselect.lua | 2 +- plugins/titleize.lua | 2 +- plugins/togglesnakecamel.lua | 2 +- plugins/typingspeed.lua | 2 +- plugins/unboundedscroll.lua | 2 +- 117 files changed, 193 insertions(+), 192 deletions(-) (limited to 'plugins/autoinsert.lua') diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index dd126c8..179a5ef 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local translate = require "core.doc.translate" local config = require "core.config" diff --git a/plugins/autosave.lua b/plugins/autosave.lua index 4501004..b63a6f6 100644 --- a/plugins/autosave.lua +++ b/plugins/autosave.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local Doc = require "core.doc" diff --git a/plugins/autosaveonfocuslost.lua b/plugins/autosaveonfocuslost.lua index 3ec97d8..1a9bd0c 100644 --- a/plugins/autosaveonfocuslost.lua +++ b/plugins/autosaveonfocuslost.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 577a1b9..a7a9765 100644 --- a/plugins/autowrap.lua +++ b/plugins/autowrap.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local command = require "core.command" diff --git a/plugins/bigclock.lua b/plugins/bigclock.lua index 66b63f1..f3554ac 100644 --- a/plugins/bigclock.lua +++ b/plugins/bigclock.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local style = require "core.style" local command = require "core.command" diff --git a/plugins/bracketmatch.lua b/plugins/bracketmatch.lua index 5930b7b..a58c1af 100644 --- a/plugins/bracketmatch.lua +++ b/plugins/bracketmatch.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 09c862a..0cea084 100644 --- a/plugins/centerdoc.lua +++ b/plugins/centerdoc.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local common = require "core.common" diff --git a/plugins/colorpreview.lua b/plugins/colorpreview.lua index fb1a738..0aa7663 100644 --- a/plugins/colorpreview.lua +++ b/plugins/colorpreview.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local config = require "core.config" local common = require "core.common" local DocView = require "core.docview" diff --git a/plugins/copyfilelocation.lua b/plugins/copyfilelocation.lua index 51bcaac..eb7b1a9 100644 --- a/plugins/copyfilelocation.lua +++ b/plugins/copyfilelocation.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua index 2cbc410..28b07c8 100644 --- a/plugins/datetimestamps.lua +++ b/plugins/datetimestamps.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local command = require "core.command" diff --git a/plugins/dragdropselected.lua b/plugins/dragdropselected.lua index 18db048..ec998aa 100644 --- a/plugins/dragdropselected.lua +++ b/plugins/dragdropselected.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 --[[ dragdropselected.lua provides basic drag and drop of selected text (in same document) diff --git a/plugins/ephemeral_tabs.lua b/plugins/ephemeral_tabs.lua index e810e92..f61c493 100644 --- a/plugins/ephemeral_tabs.lua +++ b/plugins/ephemeral_tabs.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 7658298..36cc714 100644 --- a/plugins/eval.lua +++ b/plugins/eval.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" diff --git a/plugins/exec.lua b/plugins/exec.lua index 5e7ce96..29c8e85 100644 --- a/plugins/exec.lua +++ b/plugins/exec.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" diff --git a/plugins/extend_selection_line.lua b/plugins/extend_selection_line.lua index 968399c..e002674 100644 --- a/plugins/extend_selection_line.lua +++ b/plugins/extend_selection_line.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local DocView = require "core.docview" local style = require "core.style" diff --git a/plugins/fontconfig.lua b/plugins/fontconfig.lua index 6b1047c..8b713b5 100644 --- a/plugins/fontconfig.lua +++ b/plugins/fontconfig.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local subprocess = require "process" local core = require "core" diff --git a/plugins/force_syntax.lua b/plugins/force_syntax.lua index e5d17e2..48a1853 100644 --- a/plugins/force_syntax.lua +++ b/plugins/force_syntax.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local Doc = require "core.doc" local syntax = require "core.syntax" diff --git a/plugins/ghmarkdown.lua b/plugins/ghmarkdown.lua index 9a7fc00..244b144 100644 --- a/plugins/ghmarkdown.lua +++ b/plugins/ghmarkdown.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 9ba792c..fc7a2ea 100644 --- a/plugins/gitstatus.lua +++ b/plugins/gitstatus.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local common = require "core.common" local config = require "core.config" diff --git a/plugins/gofmt.lua b/plugins/gofmt.lua index 2f0aece..fec95e4 100644 --- a/plugins/gofmt.lua +++ b/plugins/gofmt.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" local keymap = require "core.keymap" diff --git a/plugins/indent_convert.lua b/plugins/indent_convert.lua index af241a7..3a950f5 100644 --- a/plugins/indent_convert.lua +++ b/plugins/indent_convert.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local common = require "core.common" local config = require "core.config" diff --git a/plugins/indentguide.lua b/plugins/indentguide.lua index 8d78ee3..71c6269 100644 --- a/plugins/indentguide.lua +++ b/plugins/indentguide.lua @@ -1,4 +1,4 @@ ---- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local style = require "core.style" local config = require "core.config" local DocView = require "core.docview" diff --git a/plugins/language_R.lua b/plugins/language_R.lua index 8dd3779..a0bebed 100644 --- a/plugins/language_R.lua +++ b/plugins/language_R.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add{ @@ -15,7 +15,7 @@ syntax.add{ {pattern = "0x[%da-fA-F]+", type = "number"}, {pattern = "-?%d+[%d%.eE]*", type = "number"}, {pattern = "-?%.?%d+", type = "number"}, - + }, symbols = { ["TRUE"] = "literal", diff --git a/plugins/language_angelscript.lua b/plugins/language_angelscript.lua index b6e4e92..4e003ea 100644 --- a/plugins/language_angelscript.lua +++ b/plugins/language_angelscript.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_batch.lua b/plugins/language_batch.lua index c763762..32510c8 100644 --- a/plugins/language_batch.lua +++ b/plugins/language_batch.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" -- batch syntax for lite diff --git a/plugins/language_bib.lua b/plugins/language_bib.lua index 844ce76..1850ec6 100644 --- a/plugins/language_bib.lua +++ b/plugins/language_bib.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_cmake.lua b/plugins/language_cmake.lua index 3d89337..19f1aa5 100644 --- a/plugins/language_cmake.lua +++ b/plugins/language_cmake.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_cpp.lua b/plugins/language_cpp.lua index 3b8ff6c..4c66f8c 100644 --- a/plugins/language_cpp.lua +++ b/plugins/language_cpp.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" diff --git a/plugins/language_crystal.lua b/plugins/language_crystal.lua index 3c833a1..7f93c25 100644 --- a/plugins/language_crystal.lua +++ b/plugins/language_crystal.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- based on the ruby plugin, see https://github.com/Tamnac/lite-xl-plugins to contribute local syntax = require "core.syntax" diff --git a/plugins/language_csharp.lua b/plugins/language_csharp.lua index f446e51..c137b63 100644 --- a/plugins/language_csharp.lua +++ b/plugins/language_csharp.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_d.lua b/plugins/language_d.lua index 05f9a4e..6788f0b 100644 --- a/plugins/language_d.lua +++ b/plugins/language_d.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_dart.lua b/plugins/language_dart.lua index 52a2689..03274b2 100644 --- a/plugins/language_dart.lua +++ b/plugins/language_dart.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_diff.lua b/plugins/language_diff.lua index 1acc886..c4c5a90 100644 --- a/plugins/language_diff.lua +++ b/plugins/language_diff.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" local style = require "core.style" local common = require "core.common" diff --git a/plugins/language_elixir.lua b/plugins/language_elixir.lua index f1921a7..8f47770 100644 --- a/plugins/language_elixir.lua +++ b/plugins/language_elixir.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_elm.lua b/plugins/language_elm.lua index 9d3a928..2d33813 100644 --- a/plugins/language_elm.lua +++ b/plugins/language_elm.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_fe.lua b/plugins/language_fe.lua index 415ff6f..aee9b85 100644 --- a/plugins/language_fe.lua +++ b/plugins/language_fe.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_fennel.lua b/plugins/language_fennel.lua index 96283c1..9e29108 100644 --- a/plugins/language_fennel.lua +++ b/plugins/language_fennel.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- 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_fstab.lua b/plugins/language_fstab.lua index 869debd..bbe418e 100644 --- a/plugins/language_fstab.lua +++ b/plugins/language_fstab.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" @@ -7,7 +7,7 @@ syntax.add { files = { "fstab" }, comment = '#', patterns = { - -- Only lines that start with a # are comments; you can have #'s in fuse + -- Only lines that start with a # are comments; you can have #'s in fuse -- filesystem strings that aren't comments, so shouldn't be highlighted as such. { regex = "^#.*$", type = "comment" }, { pattern = "[=/:.,]+", type = "operator" }, @@ -45,7 +45,7 @@ syntax.add { ["LABEL"] = "keyword", ["UUID"] = "keyword", - + -- filesystems ["aufs"] = "keyword2", ["autofs"] = "keyword2", diff --git a/plugins/language_gdscript.lua b/plugins/language_gdscript.lua index 92a2b64..d03dce8 100644 --- a/plugins/language_gdscript.lua +++ b/plugins/language_gdscript.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- 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 541642d..360e11f 100644 --- a/plugins/language_glsl.lua +++ b/plugins/language_glsl.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local style = require "core.style" local common = require "core.common" diff --git a/plugins/language_gmi.lua b/plugins/language_gmi.lua index d1a1fc5..c5d819a 100644 --- a/plugins/language_gmi.lua +++ b/plugins/language_gmi.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" diff --git a/plugins/language_go.lua b/plugins/language_go.lua index 151d476..1ce311e 100644 --- a/plugins/language_go.lua +++ b/plugins/language_go.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_hlsl.lua b/plugins/language_hlsl.lua index a4976d1..e1d5570 100644 --- a/plugins/language_hlsl.lua +++ b/plugins/language_hlsl.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local style = require "core.style" local common = require "core.common" diff --git a/plugins/language_hs.lua b/plugins/language_hs.lua index 60b0b8f..4271210 100644 --- a/plugins/language_hs.lua +++ b/plugins/language_hs.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_ini.lua b/plugins/language_ini.lua index 0c59224..2f5d3b5 100644 --- a/plugins/language_ini.lua +++ b/plugins/language_ini.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" diff --git a/plugins/language_java.lua b/plugins/language_java.lua index 5a81a2d..30c1249 100644 --- a/plugins/language_java.lua +++ b/plugins/language_java.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_jiyu.lua b/plugins/language_jiyu.lua index a82feca..dbf9d0e 100644 --- a/plugins/language_jiyu.lua +++ b/plugins/language_jiyu.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_jsx.lua b/plugins/language_jsx.lua index 17d949e..90d9979 100644 --- a/plugins/language_jsx.lua +++ b/plugins/language_jsx.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- 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_julia.lua b/plugins/language_julia.lua index 6dd223d..347592f 100644 --- a/plugins/language_julia.lua +++ b/plugins/language_julia.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- Support for the Julia programming language: -- Covers the most used keywords up to Julia version 1.6.4 diff --git a/plugins/language_liquid.lua b/plugins/language_liquid.lua index ea8992f..ad40a79 100644 --- a/plugins/language_liquid.lua +++ b/plugins/language_liquid.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" local liquid_syntax = { @@ -92,7 +92,7 @@ local liquid_syntax = { ["upcase"] = "keyword2", ["when"] = "keyword", ["where"] = "keyword2" - + }, } @@ -102,27 +102,27 @@ syntax.add { patterns = { { pattern = { "{%%", "%%}" }, syntax = liquid_syntax, type = "function" }, { pattern = { "{{", "}}" }, syntax = liquid_syntax, type = "function" }, - { - pattern = { + { + pattern = { "<%s*[sS][cC][rR][iI][pP][tT]%s+[tT][yY][pP][eE]%s*=%s*" .. "['\"]%a+/[jJ][aA][vV][aA][sS][cC][rR][iI][pP][tT]['\"]%s*>", - "<%s*/[sS][cC][rR][iI][pP][tT]>" + "<%s*/[sS][cC][rR][iI][pP][tT]>" }, - syntax = ".js", - type = "function" + syntax = ".js", + type = "function" }, - { - pattern = { + { + pattern = { "<%s*[sS][cC][rR][iI][pP][tT]%s*>", - "<%s*/%s*[sS][cC][rR][iI][pP][tT]>" + "<%s*/%s*[sS][cC][rR][iI][pP][tT]>" }, syntax = ".js", type = "function" }, - { - pattern = { - "<%s*[sS][tT][yY][lL][eE][^>]*>", - "<%s*/%s*[sS][tT][yY][lL][eE]%s*>" + { + pattern = { + "<%s*[sS][tT][yY][lL][eE][^>]*>", + "<%s*/%s*[sS][tT][yY][lL][eE]%s*>" }, syntax = ".css", type = "function" diff --git a/plugins/language_lobster.lua b/plugins/language_lobster.lua index 60f5577..24f4251 100644 --- a/plugins/language_lobster.lua +++ b/plugins/language_lobster.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { @@ -46,7 +46,7 @@ syntax.add { ["string"] = "keyword2", ["any"] = "keyword2", ["void"] = "keyword2", - + ["is"] = "keyword", ["typeof"] = "keyword", ["var"] = "keyword", @@ -59,7 +59,7 @@ syntax.add { ["not"] = "operator", ["and"] = "operator", - ["or"] = "operator", + ["or"] = "operator", ["nil"] = "literal", }, diff --git a/plugins/language_make.lua b/plugins/language_make.lua index 39bc9ab..4ad3521 100644 --- a/plugins/language_make.lua +++ b/plugins/language_make.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_meson.lua b/plugins/language_meson.lua index b8cc680..1f7f366 100644 --- a/plugins/language_meson.lua +++ b/plugins/language_meson.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_moon.lua b/plugins/language_moon.lua index 60c1dc2..8042b7d 100644 --- a/plugins/language_moon.lua +++ b/plugins/language_moon.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_nginx.lua b/plugins/language_nginx.lua index 660b529..7124c1a 100644 --- a/plugins/language_nginx.lua +++ b/plugins/language_nginx.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" -- Copied from https://github.com/shanoor/vscode-nginx/blob/master/syntaxes/nginx.tmLanguage diff --git a/plugins/language_nim.lua b/plugins/language_nim.lua index 40327e7..d7726d1 100644 --- a/plugins/language_nim.lua +++ b/plugins/language_nim.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" local patterns = {} diff --git a/plugins/language_objc.lua b/plugins/language_objc.lua index 172f895..8d1210b 100644 --- a/plugins/language_objc.lua +++ b/plugins/language_objc.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_odin.lua b/plugins/language_odin.lua index bcf054e..a5dfa45 100644 --- a/plugins/language_odin.lua +++ b/plugins/language_odin.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_perl.lua b/plugins/language_perl.lua index bd00fee..0e057e2 100644 --- a/plugins/language_perl.lua +++ b/plugins/language_perl.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_php.lua b/plugins/language_php.lua index 139da4b..d2f7643 100644 --- a/plugins/language_php.lua +++ b/plugins/language_php.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 --[[ language_php.lua provides php syntax support allowing mixed html, css and js diff --git a/plugins/language_pico8.lua b/plugins/language_pico8.lua index 7c8bd1e..aefd6f6 100644 --- a/plugins/language_pico8.lua +++ b/plugins/language_pico8.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_pkgbuild.lua b/plugins/language_pkgbuild.lua index c390c75..049a5d1 100644 --- a/plugins/language_pkgbuild.lua +++ b/plugins/language_pkgbuild.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_po.lua b/plugins/language_po.lua index db2bdf8..a1b098c 100644 --- a/plugins/language_po.lua +++ b/plugins/language_po.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_powershell.lua b/plugins/language_powershell.lua index e7c64ea..3350419 100644 --- a/plugins/language_powershell.lua +++ b/plugins/language_powershell.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_psql.lua b/plugins/language_psql.lua index 83774dc..b891dae 100644 --- a/plugins/language_psql.lua +++ b/plugins/language_psql.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" -- In sql symbols can be lower case and upper case diff --git a/plugins/language_rescript.lua b/plugins/language_rescript.lua index 34d04e9..3d3bca0 100644 --- a/plugins/language_rescript.lua +++ b/plugins/language_rescript.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_rivet.lua b/plugins/language_rivet.lua index 58cdedf..30d5e4e 100644 --- a/plugins/language_rivet.lua +++ b/plugins/language_rivet.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- Syntax highlighting for the Rivet programming language. -- by StunxFS :) diff --git a/plugins/language_ruby.lua b/plugins/language_ruby.lua index f4e8e73..af700c2 100644 --- a/plugins/language_ruby.lua +++ b/plugins/language_ruby.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_rust.lua b/plugins/language_rust.lua index 9071db6..44a9980 100644 --- a/plugins/language_rust.lua +++ b/plugins/language_rust.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_sass.lua b/plugins/language_sass.lua index 92c6fec..f440927 100644 --- a/plugins/language_sass.lua +++ b/plugins/language_sass.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_scala.lua b/plugins/language_scala.lua index c3dd943..6c5d7a7 100644 --- a/plugins/language_scala.lua +++ b/plugins/language_scala.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { @@ -19,62 +19,62 @@ syntax.add { { pattern = "[%a_][%w_]*", type = "symbol" }, }, symbols = { - ["abstract"] = "keyword", - ["case"] = "keyword", - ["catch"] = "keyword", - ["class"] = "keyword", - ["finally"] = "keyword", - ["final"] = "keyword", - ["do"] = "keyword", - ["extends"] = "keyword", - ["forSome"] = "keyword", - ["implicit"] = "keyword", - ["lazy"] = "keyword", - ["match"] = "keyword", - ["new"] = "keyword", - ["override"] = "keyword", - ["package"] = "keyword", - ["throw"] = "keyword", - ["trait"] = "keyword", - ["type"] = "keyword", - ["var"] = "keyword", - ["val"] = "keyword", + ["abstract"] = "keyword", + ["case"] = "keyword", + ["catch"] = "keyword", + ["class"] = "keyword", + ["finally"] = "keyword", + ["final"] = "keyword", + ["do"] = "keyword", + ["extends"] = "keyword", + ["forSome"] = "keyword", + ["implicit"] = "keyword", + ["lazy"] = "keyword", + ["match"] = "keyword", + ["new"] = "keyword", + ["override"] = "keyword", + ["package"] = "keyword", + ["throw"] = "keyword", + ["trait"] = "keyword", + ["type"] = "keyword", + ["var"] = "keyword", + ["val"] = "keyword", ["println"] = "keyword", - ["return"] = "keyword", - ["for"] = "keyword", - ["Try"] = "keyword", - ["def"] = "keyword", - ["while"] = "keyword", - ["with"] = "keyword", - ["if"] = "keyword", - ["else"] = "keyword", - ["import"] = "keyword", - ["object"] = "keyword", - ["yield"] = "keyword", - - ["private"] = "keyword2", - ["protected"] = "keyword2", - ["sealed"] = "keyword2", - ["super"] = "keyword2", - ["this"] = "keyword2", - ["Byte"] = "keyword2", - ["Short"] = "keyword2", - ["Int"] = "keyword2", - ["Long"] = "keyword2", - ["Float"] = "keyword2", - ["Double"] = "keyword2", - ["Char"] = "keyword2", - ["String"] = "keyword2", - ["List"] = "keyword2", - ["Array"] = "keyword2", - ["Boolean"] = "keyword2", - - ["Null"] = "literal", - ["Any"] = "literal", - ["AnyRef"] = "literal", - ["Nothing"] = "literal", - ["Unit"] = "literal", - ["true"] = "literal", - ["false"] = "literal", + ["return"] = "keyword", + ["for"] = "keyword", + ["Try"] = "keyword", + ["def"] = "keyword", + ["while"] = "keyword", + ["with"] = "keyword", + ["if"] = "keyword", + ["else"] = "keyword", + ["import"] = "keyword", + ["object"] = "keyword", + ["yield"] = "keyword", + + ["private"] = "keyword2", + ["protected"] = "keyword2", + ["sealed"] = "keyword2", + ["super"] = "keyword2", + ["this"] = "keyword2", + ["Byte"] = "keyword2", + ["Short"] = "keyword2", + ["Int"] = "keyword2", + ["Long"] = "keyword2", + ["Float"] = "keyword2", + ["Double"] = "keyword2", + ["Char"] = "keyword2", + ["String"] = "keyword2", + ["List"] = "keyword2", + ["Array"] = "keyword2", + ["Boolean"] = "keyword2", + + ["Null"] = "literal", + ["Any"] = "literal", + ["AnyRef"] = "literal", + ["Nothing"] = "literal", + ["Unit"] = "literal", + ["true"] = "literal", + ["false"] = "literal", } } diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua index c72f2c3..5d7b987 100644 --- a/plugins/language_sh.lua +++ b/plugins/language_sh.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_ssh_config.lua b/plugins/language_ssh_config.lua index cb05049..894ce21 100644 --- a/plugins/language_ssh_config.lua +++ b/plugins/language_ssh_config.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_tcl.lua b/plugins/language_tcl.lua index 5811de6..7a6e13f 100644 --- a/plugins/language_tcl.lua +++ b/plugins/language_tcl.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_teal.lua b/plugins/language_teal.lua index 62b4351..0b0e35d 100644 --- a/plugins/language_teal.lua +++ b/plugins/language_teal.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_tex.lua b/plugins/language_tex.lua index c564baa..e34d466 100644 --- a/plugins/language_tex.lua +++ b/plugins/language_tex.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_toml.lua b/plugins/language_toml.lua index da5e9b8..02e5b58 100644 --- a/plugins/language_toml.lua +++ b/plugins/language_toml.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" diff --git a/plugins/language_ts.lua b/plugins/language_ts.lua index b5574fa..f28261d 100644 --- a/plugins/language_ts.lua +++ b/plugins/language_ts.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- 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 11ba09a..beedbc6 100644 --- a/plugins/language_tsx.lua +++ b/plugins/language_tsx.lua @@ -1,5 +1,6 @@ --- mod-version:3 --lite-xl 2.1 --- 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. +-- mod-version:3 +-- 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" syntax.add { diff --git a/plugins/language_v.lua b/plugins/language_v.lua index 1336e95..c7876e6 100644 --- a/plugins/language_v.lua +++ b/plugins/language_v.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_wren.lua b/plugins/language_wren.lua index f5d75e8..42f4fbd 100644 --- a/plugins/language_wren.lua +++ b/plugins/language_wren.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/language_yaml.lua b/plugins/language_yaml.lua index fdc26fa..8b7f634 100644 --- a/plugins/language_yaml.lua +++ b/plugins/language_yaml.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" local yaml_bracket_list = { diff --git a/plugins/language_zig.lua b/plugins/language_zig.lua index 9152d3f..f2c32d5 100644 --- a/plugins/language_zig.lua +++ b/plugins/language_zig.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local syntax = require "core.syntax" syntax.add { diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua index 1d9772d..ae3da75 100644 --- a/plugins/lfautoinsert.lua +++ b/plugins/lfautoinsert.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" local common = require "core.common" diff --git a/plugins/linecopypaste.lua b/plugins/linecopypaste.lua index 23933a1..7be8492 100644 --- a/plugins/linecopypaste.lua +++ b/plugins/linecopypaste.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" diff --git a/plugins/linenumbers.lua b/plugins/linenumbers.lua index 5cf198a..03b5fb2 100644 --- a/plugins/linenumbers.lua +++ b/plugins/linenumbers.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local config = require "core.config" local style = require "core.style" local DocView = require "core.docview" diff --git a/plugins/macmodkeys.lua b/plugins/macmodkeys.lua index f49698e..e4656b9 100644 --- a/plugins/macmodkeys.lua +++ b/plugins/macmodkeys.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local keymap = require "core.keymap" local on_key_pressed = keymap.on_key_pressed diff --git a/plugins/markers.lua b/plugins/markers.lua index 176eff1..e2ec68e 100644 --- a/plugins/markers.lua +++ b/plugins/markers.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- Markers plugin for lite text editor -- original implementation by Petri Häkkinen diff --git a/plugins/memoryusage.lua b/plugins/memoryusage.lua index a8b8005..d84a8c2 100644 --- a/plugins/memoryusage.lua +++ b/plugins/memoryusage.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- original implementation by AqilCont local core = require "core" local config = require "core.config" diff --git a/plugins/minimap.lua b/plugins/minimap.lua index 932f9dd..feaded2 100644 --- a/plugins/minimap.lua +++ b/plugins/minimap.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" local common = require "core.common" diff --git a/plugins/motiontrail.lua b/plugins/motiontrail.lua index cc94ca9..16e7307 100644 --- a/plugins/motiontrail.lua +++ b/plugins/motiontrail.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local common = require "core.common" diff --git a/plugins/navigate.lua b/plugins/navigate.lua index 373fe83..d83c02f 100644 --- a/plugins/navigate.lua +++ b/plugins/navigate.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local common = require "core.common" diff --git a/plugins/nonicons.lua b/plugins/nonicons.lua index e249508..9540ce6 100644 --- a/plugins/nonicons.lua +++ b/plugins/nonicons.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- Author: Jipok -- Doesn't work well with scaling mode == "ui" diff --git a/plugins/opacity.lua b/plugins/opacity.lua index f3a9d81..a97cae9 100644 --- a/plugins/opacity.lua +++ b/plugins/opacity.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local common = require "core.common" local command = require "core.command" diff --git a/plugins/open_ext.lua b/plugins/open_ext.lua index 1f6b19c..4c57d68 100644 --- a/plugins/open_ext.lua +++ b/plugins/open_ext.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- The general idea is to check if the file opened is valid utf-8 -- since lite-xl only supports UTF8 text, others can be safely assumed diff --git a/plugins/openfilelocation.lua b/plugins/openfilelocation.lua index 8e225cd..603c7b6 100644 --- a/plugins/openfilelocation.lua +++ b/plugins/openfilelocation.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local common = require "core.common" local command = require "core.command" diff --git a/plugins/openselected.lua b/plugins/openselected.lua index 7df4dba..6333da9 100644 --- a/plugins/openselected.lua +++ b/plugins/openselected.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 1634058..199584e 100644 --- a/plugins/pdfview.lua +++ b/plugins/pdfview.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 04cdfaf..0f4c5c8 100644 --- a/plugins/rainbowparen.lua +++ b/plugins/rainbowparen.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local style = require "core.style" local config = require "core.config" diff --git a/plugins/regexreplacepreview.lua b/plugins/regexreplacepreview.lua index 0900480..85845ad 100644 --- a/plugins/regexreplacepreview.lua +++ b/plugins/regexreplacepreview.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 5c06e80..4c33304 100644 --- a/plugins/restoretabs.lua +++ b/plugins/restoretabs.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 -- 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/scalestatus.lua b/plugins/scalestatus.lua index 2379ed4..aa08cdc 100644 --- a/plugins/scalestatus.lua +++ b/plugins/scalestatus.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 --[[ scalestatus.lua displays current scale (zoom) in status view diff --git a/plugins/select_colorscheme.lua b/plugins/select_colorscheme.lua index b1e8b6e..4406aa1 100644 --- a/plugins/select_colorscheme.lua +++ b/plugins/select_colorscheme.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" local common = require "core.common" diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua index d17acff..133dced 100644 --- a/plugins/selectionhighlight.lua +++ b/plugins/selectionhighlight.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local style = require "core.style" local DocView = require "core.docview" diff --git a/plugins/settings.lua b/plugins/settings.lua index e568c48..bffb697 100644 --- a/plugins/settings.lua +++ b/plugins/settings.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 --priority:0 +-- mod-version:3 --priority:0 local core = require "core" local config = require "core.config" local common = require "core.common" diff --git a/plugins/smallclock.lua b/plugins/smallclock.lua index 7bc756c..7c845d7 100644 --- a/plugins/smallclock.lua +++ b/plugins/smallclock.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local common = require "core.common" diff --git a/plugins/smoothcaret.lua b/plugins/smoothcaret.lua index 3a30d5b..5639ff2 100644 --- a/plugins/smoothcaret.lua +++ b/plugins/smoothcaret.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local style = require "core.style" diff --git a/plugins/sort.lua b/plugins/sort.lua index a729624..1ad4034 100644 --- a/plugins/sort.lua +++ b/plugins/sort.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 0f79cab..23a5fa9 100644 --- a/plugins/spellcheck.lua +++ b/plugins/spellcheck.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local style = require "core.style" local config = require "core.config" diff --git a/plugins/statusclock.lua b/plugins/statusclock.lua index 6d37b37..0fe95dd 100644 --- a/plugins/statusclock.lua +++ b/plugins/statusclock.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local style = require "core.style" diff --git a/plugins/tabnumbers.lua b/plugins/tabnumbers.lua index 3a842b7..97e5d10 100644 --- a/plugins/tabnumbers.lua +++ b/plugins/tabnumbers.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local config = require "core.config" local common = require "core.common" local style = require "core.style" diff --git a/plugins/texcompile.lua b/plugins/texcompile.lua index 9eb30c5..af31aed 100644 --- a/plugins/texcompile.lua +++ b/plugins/texcompile.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local config = require "core.config" local command = require "core.command" diff --git a/plugins/themeselect.lua b/plugins/themeselect.lua index 05af749..6a06715 100644 --- a/plugins/themeselect.lua +++ b/plugins/themeselect.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 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 b329671..16d20b0 100644 --- a/plugins/titleize.lua +++ b/plugins/titleize.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" diff --git a/plugins/togglesnakecamel.lua b/plugins/togglesnakecamel.lua index cd68bba..c055933 100644 --- a/plugins/togglesnakecamel.lua +++ b/plugins/togglesnakecamel.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local core = require "core" local command = require "core.command" local keymap = require "core.keymap" diff --git a/plugins/typingspeed.lua b/plugins/typingspeed.lua index d639252..14bd91c 100644 --- a/plugins/typingspeed.lua +++ b/plugins/typingspeed.lua @@ -1,4 +1,4 @@ --- mod-version:2 +-- mod-version:3 local core = require "core" local style = require "core.style" diff --git a/plugins/unboundedscroll.lua b/plugins/unboundedscroll.lua index 93f8144..0793cfa 100644 --- a/plugins/unboundedscroll.lua +++ b/plugins/unboundedscroll.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 local command = require "core.command" local DocView = require "core.docview" -- cgit v1.2.3 From 7094fea734f07d324667be1f9fd460c072ff7d10 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Mon, 11 Jul 2022 05:59:36 +0200 Subject: `autoinsert`: avoid deleting wrong characters --- plugins/autoinsert.lua | 160 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 157 insertions(+), 3 deletions(-) (limited to 'plugins/autoinsert.lua') diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index 179a5ef..a31f469 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -89,9 +89,12 @@ command.add(predicate, { ["autoinsert:backspace"] = function() local doc = core.active_view.doc local l, c = doc:get_selection() - local chr = doc:get_char(l, c) - if config.plugins.autoinsert.map[doc:get_char(l, c - 1)] and is_closer(chr) then - doc:delete_to(1) + if c > 1 then + local chr = doc:get_char(l, c) + local mapped = config.plugins.autoinsert.map[doc:get_char(l, c - 1)] + if mapped and mapped == chr then + doc:delete_to(1) + end end command.perform "doc:backspace" end, @@ -114,3 +117,154 @@ keymap.add { ["ctrl+backspace"] = "autoinsert:delete-to-previous-word-start", ["ctrl+shift+backspace"] = "autoinsert:delete-to-previous-word-start", } + + + + + + + + +--]] + + + + + + +-- --[[ + + + +-- -- mod-version:3 +-- 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 = common.merge({ map = { +-- ["["] = "]", +-- ["{"] = "}", +-- ["("] = ")", +-- ['"'] = '"', +-- ["'"] = "'", +-- ["`"] = "`", +-- } }, config.plugins.autoinsert) + + +-- local function is_closer(chr) +-- for _, v in pairs(config.plugins.autoinsert.map) do +-- if v == chr then +-- return true +-- end +-- end +-- end + +-- local function count_char(text, chr) +-- local count = 0 +-- local index = 1 +-- while true do +-- local s, e = text:find(chr, index, true) +-- if not s then break end +-- count = count + 1 +-- index = e + 1 +-- end +-- return count +-- end + + +-- local on_text_input = DocView.on_text_input + +-- function DocView:on_text_input(text) +-- local mapping = config.plugins.autoinsert.map[text] +-- local opener, closer = mapping and true, is_closer(text) + +-- -- prevents plugin from operating on `CommandView` +-- if (not opener and not closer) or not self:is(DocView) then +-- return on_text_input(self, text) +-- end + +-- local l1, c1, l2, c2, swap = self.doc:get_selection(true) +-- print(swap) + +-- for idx, line1, col1, line2, col2, swap in self.doc:get_selections(true) do +-- if opener and closer then +-- -- if the opener and closer characters are the same +-- -- we only consider the opener case if we're not near one +-- if self.doc:get_char(line1, col1, line2, col2) == text then +-- opener = false +-- end +-- end +-- if opener then +-- -- is selection +-- if line1 ~= line2 or col1 ~= col2 then +-- self.doc:insert(line2, col2, mapping) +-- self.doc:insert(line1, col1, text) +-- print(line1, col1, line2, col2, swap) +-- self.doc:set_selections(idx, line1, col1+1, line2, col2+1, swap) +-- else +-- self.doc:text_input(text, idx) +-- -- if the opener and closer chars are the same, we only add the closer one +-- -- if there is an odd number of them in the line +-- if text ~= mapping or (text == mapping and count_char(self.doc.lines[line1], mapping) % 2 == 1) then +-- self.doc:text_input(mapping, idx) +-- self.doc:move_to_cursor(idx, -#mapping) +-- end +-- end +-- else -- closer +-- if line1 == line2 and col1 == col2 then +-- local chr = self.doc:get_char(line1, col1, line2, col2) +-- -- skip inserting closing text +-- if text == chr then +-- self.doc:move_to_cursor(idx, #text) +-- else +-- self.doc:text_input(text, idx) +-- end +-- else -- if we're in a selection we behave as normal +-- self.doc:text_input(text, idx) +-- end +-- end +-- end +-- end + + + +-- local function predicate() +-- return getmetatable(core.active_view) == DocView +-- and not core.active_view.doc:has_selection() +-- end + +-- command.add(predicate, { +-- ["autoinsert:backspace"] = function() +-- local doc = core.active_view.doc +-- local l, c = doc:get_selection() +-- local chr = doc:get_char(l, c) +-- 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" +-- end, + +-- ["autoinsert:delete-to-previous-word-start"] = function() +-- local doc = core.active_view.doc +-- local le, ce = translate.previous_word_start(doc, doc:get_selection()) +-- while true do +-- local l, c = doc:get_selection() +-- if l == le and c == ce then +-- break +-- end +-- command.perform "autoinsert:backspace" +-- end +-- end, +-- }) + +-- keymap.add { +-- ["backspace"] = "autoinsert:backspace", +-- ["ctrl+backspace"] = "autoinsert:delete-to-previous-word-start", +-- ["ctrl+shift+backspace"] = "autoinsert:delete-to-previous-word-start", +-- } +-- --]] -- cgit v1.2.3 From a1c7102578f166df804bf5dbdbe6aac6810dff2d Mon Sep 17 00:00:00 2001 From: Guldoman Date: Mon, 11 Jul 2022 06:01:01 +0200 Subject: `autoinsert`: remove initial refactoring code added by mistake --- plugins/autoinsert.lua | 151 ------------------------------------------------- 1 file changed, 151 deletions(-) (limited to 'plugins/autoinsert.lua') diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index a31f469..c49887a 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -117,154 +117,3 @@ keymap.add { ["ctrl+backspace"] = "autoinsert:delete-to-previous-word-start", ["ctrl+shift+backspace"] = "autoinsert:delete-to-previous-word-start", } - - - - - - - - ---]] - - - - - - --- --[[ - - - --- -- mod-version:3 --- 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 = common.merge({ map = { --- ["["] = "]", --- ["{"] = "}", --- ["("] = ")", --- ['"'] = '"', --- ["'"] = "'", --- ["`"] = "`", --- } }, config.plugins.autoinsert) - - --- local function is_closer(chr) --- for _, v in pairs(config.plugins.autoinsert.map) do --- if v == chr then --- return true --- end --- end --- end - --- local function count_char(text, chr) --- local count = 0 --- local index = 1 --- while true do --- local s, e = text:find(chr, index, true) --- if not s then break end --- count = count + 1 --- index = e + 1 --- end --- return count --- end - - --- local on_text_input = DocView.on_text_input - --- function DocView:on_text_input(text) --- local mapping = config.plugins.autoinsert.map[text] --- local opener, closer = mapping and true, is_closer(text) - --- -- prevents plugin from operating on `CommandView` --- if (not opener and not closer) or not self:is(DocView) then --- return on_text_input(self, text) --- end - --- local l1, c1, l2, c2, swap = self.doc:get_selection(true) --- print(swap) - --- for idx, line1, col1, line2, col2, swap in self.doc:get_selections(true) do --- if opener and closer then --- -- if the opener and closer characters are the same --- -- we only consider the opener case if we're not near one --- if self.doc:get_char(line1, col1, line2, col2) == text then --- opener = false --- end --- end --- if opener then --- -- is selection --- if line1 ~= line2 or col1 ~= col2 then --- self.doc:insert(line2, col2, mapping) --- self.doc:insert(line1, col1, text) --- print(line1, col1, line2, col2, swap) --- self.doc:set_selections(idx, line1, col1+1, line2, col2+1, swap) --- else --- self.doc:text_input(text, idx) --- -- if the opener and closer chars are the same, we only add the closer one --- -- if there is an odd number of them in the line --- if text ~= mapping or (text == mapping and count_char(self.doc.lines[line1], mapping) % 2 == 1) then --- self.doc:text_input(mapping, idx) --- self.doc:move_to_cursor(idx, -#mapping) --- end --- end --- else -- closer --- if line1 == line2 and col1 == col2 then --- local chr = self.doc:get_char(line1, col1, line2, col2) --- -- skip inserting closing text --- if text == chr then --- self.doc:move_to_cursor(idx, #text) --- else --- self.doc:text_input(text, idx) --- end --- else -- if we're in a selection we behave as normal --- self.doc:text_input(text, idx) --- end --- end --- end --- end - - - --- local function predicate() --- return getmetatable(core.active_view) == DocView --- and not core.active_view.doc:has_selection() --- end - --- command.add(predicate, { --- ["autoinsert:backspace"] = function() --- local doc = core.active_view.doc --- local l, c = doc:get_selection() --- local chr = doc:get_char(l, c) --- 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" --- end, - --- ["autoinsert:delete-to-previous-word-start"] = function() --- local doc = core.active_view.doc --- local le, ce = translate.previous_word_start(doc, doc:get_selection()) --- while true do --- local l, c = doc:get_selection() --- if l == le and c == ce then --- break --- end --- command.perform "autoinsert:backspace" --- end --- end, --- }) - --- keymap.add { --- ["backspace"] = "autoinsert:backspace", --- ["ctrl+backspace"] = "autoinsert:delete-to-previous-word-start", --- ["ctrl+shift+backspace"] = "autoinsert:delete-to-previous-word-start", --- } --- --]] -- cgit v1.2.3