aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakase <20792268+takase1121@users.noreply.github.com>2021-05-31 11:18:12 +0800
committerGitHub <noreply@github.com>2021-05-31 11:18:12 +0800
commit0d87d70140b8c318ca171330658d3a7cf00f5037 (patch)
treeeb333ce5d63f7f393b61ac544124be5398496d3a
parenta07e30be3827f9444f967ba633171ea8c90cd41e (diff)
parent5b9a3bd28d937d131da5821f075952df80c14040 (diff)
downloadlite-xl-plugins-0d87d70140b8c318ca171330658d3a7cf00f5037.tar.gz
lite-xl-plugins-0d87d70140b8c318ca171330658d3a7cf00f5037.zip
Merge branch 'master' into contextmenu
-rw-r--r--README.md44
-rw-r--r--plugins/autoinsert.lua1
-rw-r--r--plugins/autosave.lua46
-rw-r--r--plugins/autowrap.lua1
-rw-r--r--plugins/bigclock.lua5
-rw-r--r--plugins/bracketmatch.lua1
-rw-r--r--plugins/centerdoc.lua1
-rw-r--r--plugins/closeconfirmx.lua54
-rw-r--r--plugins/colorpreview.lua1
-rw-r--r--plugins/copyfilelocation.lua8
-rw-r--r--plugins/datetimestamps.lua1
-rw-r--r--plugins/detectindent.lua64
-rw-r--r--plugins/dragdropselected.lua1
-rw-r--r--plugins/drawwhitespace.lua37
-rw-r--r--plugins/eval.lua1
-rw-r--r--plugins/exec.lua1
-rw-r--r--plugins/ghmarkdown.lua1
-rw-r--r--plugins/gitstatus.lua1
-rw-r--r--plugins/gofmt.lua1
-rw-r--r--plugins/hidelinenumbers.lua1
-rw-r--r--plugins/hidestatus.lua1
-rw-r--r--plugins/inanimate.lua12
-rw-r--r--plugins/indentguide.lua11
-rw-r--r--plugins/language_angelscript.lua1
-rw-r--r--plugins/language_batch.lua1
-rw-r--r--plugins/language_cmake.lua1
-rw-r--r--plugins/language_cpp.lua17
-rw-r--r--plugins/language_csharp.lua1
-rw-r--r--plugins/language_d.lua1
-rw-r--r--plugins/language_dart.lua1
-rw-r--r--plugins/language_elixir.lua1
-rw-r--r--plugins/language_elm.lua1
-rw-r--r--plugins/language_fe.lua1
-rw-r--r--plugins/language_fennel.lua1
-rw-r--r--plugins/language_gdscript.lua1
-rw-r--r--plugins/language_glsl.lua1
-rw-r--r--plugins/language_go.lua1
-rw-r--r--plugins/language_hlsl.lua1
-rw-r--r--plugins/language_hs.lua1
-rw-r--r--plugins/language_java.lua1
-rw-r--r--plugins/language_jiyu.lua1
-rw-r--r--plugins/language_jsx.lua69
-rw-r--r--plugins/language_liquid.lua144
-rw-r--r--plugins/language_make.lua1
-rw-r--r--plugins/language_meson.lua2
-rw-r--r--plugins/language_moon.lua1
-rw-r--r--plugins/language_nim.lua1
-rw-r--r--plugins/language_objc.lua1
-rw-r--r--plugins/language_odin.lua1
-rw-r--r--plugins/language_perl.lua259
-rw-r--r--plugins/language_php.lua155
-rw-r--r--plugins/language_phps.lua140
-rw-r--r--plugins/language_pico8.lua1
-rw-r--r--plugins/language_powershell.lua1
-rw-r--r--plugins/language_psql.lua1
-rw-r--r--plugins/language_ruby.lua74
-rw-r--r--plugins/language_rust.lua1
-rw-r--r--plugins/language_sass.lua46
-rw-r--r--plugins/language_sh.lua3
-rw-r--r--plugins/language_teal.lua1
-rw-r--r--plugins/language_tex.lua1
-rw-r--r--plugins/language_wren.lua1
-rw-r--r--plugins/language_zig.lua211
-rw-r--r--plugins/lastproject.lua29
-rw-r--r--plugins/lfautoinsert.lua2
-rwxr-xr-xplugins/linecopypaste.lua1
-rw-r--r--plugins/lineguide.lua5
-rw-r--r--plugins/macmodkeys.lua1
-rw-r--r--plugins/markers.lua1
-rw-r--r--plugins/memoryusage.lua19
-rw-r--r--plugins/motiontrail.lua1
-rw-r--r--plugins/openfilelocation.lua1
-rw-r--r--plugins/openselected.lua1
-rw-r--r--plugins/projectmanager.lua128
-rw-r--r--plugins/rainbowparen.lua1
-rw-r--r--plugins/restoretabs.lua55
-rw-r--r--plugins/scale.lua32
-rw-r--r--plugins/scalestatus.lua1
-rw-r--r--plugins/selectionhighlight.lua1
-rw-r--r--plugins/sort.lua1
-rw-r--r--plugins/spellcheck.lua1
-rw-r--r--plugins/tabnumbers.lua1
-rw-r--r--plugins/themeselect.lua48
-rw-r--r--plugins/titleize.lua1
-rw-r--r--plugins/togglesnakecamel.lua1
-rw-r--r--plugins/unboundedscroll.lua1
-rw-r--r--plugins/workspace.lua164
87 files changed, 1324 insertions, 617 deletions
diff --git a/README.md b/README.md
index 8729a6c..514f084 100644
--- a/README.md
+++ b/README.md
@@ -1,41 +1,46 @@
-Plugins for the [lite text editor](https://github.com/rxi/lite)
+Plugins for [Lite XL](https://github.com/franko/lite-xl)
*Note: if you make a pull request, the table should be updated and kept in
alphabetical order. If your plugin is large (or you'd otherwise prefer it to
have its own repo), the table can simply be updated to add a link to the repo;
otherwise the plugin file itself can be submitted. If a plugin's link resolves
-to something other than a raw file it should be marked with an asterisk.*
+to something other than a raw file it should be marked with an asterisk.
+If a plugin has modifications specific to Lite XL or is otherwise incompatible
+with the official version of lite, format the name in italic.*
---
Plugin | Description
-------|-----------------------------------------
[`autoinsert`](plugins/autoinsert.lua?raw=1) | Automatically inserts closing brackets and quotes
+*[`autosave`](plugins/autosave.lua?raw=1)* | Automatically saves files when they are changed
[`autowrap`](plugins/autowrap.lua?raw=1) | Automatically hardwraps lines when typing
-[`bigclock`](plugins/bigclock.lua?raw=1) | Shows the current time and date in a view with large text *([screenshot](https://user-images.githubusercontent.com/3920290/82752891-3318df00-9db9-11ea-803f-261d80d5cf53.png))*
+*[`bigclock`](plugins/bigclock.lua?raw=1)* | Shows the current time and date in a view with large text *([screenshot](https://user-images.githubusercontent.com/3920290/82752891-3318df00-9db9-11ea-803f-261d80d5cf53.png))*
[`black`](https://git.sr.ht/~tmpod/black-lite)* | Integrates the [black](https://github.com/psf/black) Python formatter with lite
[`bracketmatch`](plugins/bracketmatch.lua?raw=1) | Underlines matching pair for bracket under the caret *([screenshot](https://user-images.githubusercontent.com/3920290/80132745-0c863f00-8594-11ea-8875-c455c6fd7eae.png))*
[`centerdoc`](plugins/centerdoc.lua?raw=1) | Centers document's content on the screen *([screenshot](https://user-images.githubusercontent.com/3920290/82127896-bf6e4500-97ae-11ea-97fc-ba9a552bc9a4.png))*
-[`closeconfirmx`](plugins/closeconfirmx.lua?raw=1) | Replaces a system close confirmation dialog with a command view, like for individual files *([screenshot](https://user-images.githubusercontent.com/1689801/107596774-afa76280-6c53-11eb-80ab-22e73058c097.png))*
+~~[`closeconfirmx`](plugins/closeconfirmx.lua?raw=1)~~ | Replaced by NagView dialog ~~Replaces a system close confirmation dialog with a command view, like for individual files *([screenshot](https://user-images.githubusercontent.com/1689801/107596774-afa76280-6c53-11eb-80ab-22e73058c097.png))*~~
[`colorpreview`](plugins/colorpreview.lua?raw=1) | Underlays color values (eg. `#ff00ff` or `rgb(255, 0, 255)`) with their resultant color. *([screenshot](https://user-images.githubusercontent.com/3920290/80743752-731bd780-8b15-11ea-97d3-847db927c5dc.png))*
-[`console`](https://github.com/rxi/console)* | A console for running external commands and capturing their output *([gif](https://user-images.githubusercontent.com/3920290/81343656-49325a00-90ad-11ea-8647-ff39d8f1d730.gif))*
+*[`console`](https://github.com/franko/console)* | A console for running external commands and capturing their output *([gif](https://user-images.githubusercontent.com/3920290/81343656-49325a00-90ad-11ea-8647-ff39d8f1d730.gif))*
[`contextmenu`](https://github.com/takase1121/lite-contextmenu)* | Simple context menu *([screenshot](https://github.com/takase1121/lite-contextmenu/blob/master/assets/screenshot.jpg?raw=true))*
[`copyfilelocation`](plugins/copyfilelocation.lua?raw=1) | Copy file location to clipboard
[`datetimestamps`](plugins/datetimestamps.lua?raw=1) | Insert date-, time- and date-time-stamps
-[`detectindent`](plugins/detectindent.lua?raw=1) | Automatically detects and uses the indentation size and tab type of a loaded file
+~~[`detectindent`](plugins/detectindent.lua?raw=1)~~ | Included with lite-xl ~~Automatically detects and uses the indentation size and tab type of a loaded file~~
+*[`discord-presence`](https://github.com/vincens2005/lite-xl-discord)* * | Adds the current workspace and file to your Discord Rich Presence
[`dragdropselected`](plugins/dragdropselected.lua?raw=1) | Provides basic drag and drop of selected text (in same document)
-[`drawwhitespace`](plugins/drawwhitespace.lua?raw=1) | Draws tabs and spaces *([screenshot](https://user-images.githubusercontent.com/3920290/80573013-22ae5800-89f7-11ea-9895-6362a1c0abc7.png))*
-[`eofnewline`](https://github.com/bokunodev/lite_modules/blob/master/plugins/eofnewline.lua?raw=1) | Make sure the file ends with one blank line.
+~~*[`drawwhitespace`](plugins/drawwhitespace.lua?raw=1)*~~ | Integrated with lite-xl reducing CPU usage ~~Draws tabs and spaces *([screenshot](https://user-images.githubusercontent.com/3920290/80573013-22ae5800-89f7-11ea-9895-6362a1c0abc7.png))*~~
+[`eofnewline`](https://github.com/bokunodev/lite_modules/blob/master/plugins/eofnewline-xl.lua?raw=1) | Make sure the file ends with one blank line.
[`eval`](plugins/eval.lua?raw=1) | Replaces selected Lua code with its evaluated result
[`exec`](plugins/exec.lua?raw=1) | Runs selected text through shell command and replaces with result
[`fallbackfonts`](https://github.com/takase1121/lite-fallback-fonts)* | Adds support for fallback fonts *([gif](https://raw.githubusercontent.com/takase1121/lite-fallback-fonts/master/assets/Iw18fI57J0.gif))*
+[`formatter`](https://github.com/vincens2005/lite-formatters)* | formatters for various languages
[`ghmarkdown`](plugins/ghmarkdown.lua?raw=1) | Opens a preview of the current markdown file in a browser window *([screenshot](https://user-images.githubusercontent.com/3920290/82754898-f7394600-9dc7-11ea-8278-2305363ed372.png))*
[`gitstatus`](plugins/gitstatus.lua?raw=1) | Displays git branch and insert/delete count in status bar *([screenshot](https://user-images.githubusercontent.com/3920290/81107223-bcea3080-8f0e-11ea-8fc7-d03173f42e33.png))*
[`gofmt`](plugins/gofmt.lua?raw=1) | Auto-formats the current go file, adds the missing imports and the missing return cases
[`hidelinenumbers`](plugins/hidelinenumbers.lua?raw=1) | Hides the line numbers on the left of documents *([screenshot](https://user-images.githubusercontent.com/3920290/81692043-b8b19c00-9455-11ea-8d74-ad99be4b9c5f.png))*
[`hidestatus`](plugins/hidestatus.lua?raw=1) | Hides the status bar at the bottom of the window
-[`inanimate`](plugins/inanimate.lua?raw=1) | Disables all transition animations
-[`indentguide`](plugins/indentguide.lua?raw=1) | Adds indent guides *([screenshot](https://user-images.githubusercontent.com/3920290/79640716-f9860000-818a-11ea-9c3b-26d10dd0e0c0.png))*
+~~[`inanimate`](plugins/inanimate.lua?raw=1)~~ | Integrated in lite-xl using `config.transitions = false` ~~Disables all transition animations~~
+*[`indentguide`](plugins/indentguide.lua?raw=1)* | Adds indent guides *([screenshot](https://user-images.githubusercontent.com/3920290/79640716-f9860000-818a-11ea-9c3b-26d10dd0e0c0.png))*
[`language_angelscript`](plugins/language_angelscript.lua?raw=1) | Syntax for the [Angelscript](https://www.angelcode.com/angelscript/) programming language
[`language_batch`](plugins/language_batch.lua?raw=1) | Syntax for Windows [Batch Files](https://en.wikipedia.org/wiki/Batch_file)
[`language_cmake`](plugins/language_cmake.lua?raw=1) | Syntax for the CMake build system language
@@ -54,37 +59,45 @@ Plugin | Description
[`language_hs`](plugins/language_hs.lua?raw=1) | Syntax for the [Haskell](https://www.haskell.org/) programming language
[`language_java`](plugins/language_java.lua?raw=1) | Syntax for the [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) programming language
[`language_jiyu`](plugins/language_jiyu.lua?raw=1) | Syntax for the [jiyu](https://github.com/machinamentum/jiyu) programming language
+[`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript
[`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files
+[`language_liquid`](plugins/language_liquid.lua?raw=1) | Syntax for [Liquid](https://shopify.github.io/liquid/) templating language
[`language_make`](plugins/language_make.lua?raw=1) | Syntax for the Make build system language
[`language_meson`](plugins/language_meson.lua?raw=1) | Syntax for the [Meson](https://mesonbuild.com) build system language
[`language_moon`](plugins/language_moon.lua?raw=1) | Syntax for the [MoonScript](https://moonscript.org) scripting language
[`language_nim`](plugins/language_nim.lua?raw=1) | Syntax for the [Nim](https://nim-lang.org) programming language
[`language_objc`](plugins/language_objc.lua?raw=1) | Syntax for the [Objective C](https://en.wikipedia.org/wiki/Objective-C) programming language
[`language_odin`](plugins/language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) programming language
+[`language_perl`](plugins/language_perl.lua?raw=1) | Syntax for the [Perl](https://perl.org) programming language
[`language_php`](plugins/language_php.lua?raw=1) | Syntax for the [PHP](https://php.net) programming language
[`language_pico8`](plugins/language_pico8.lua?raw=1) | Syntax for [Pico-8](https://www.lexaloffle.com/pico-8.php) cartridge files
[`language_powershell`](plugins/language_powershell.lua?raw=1) | Syntax for [PowerShell](https://docs.microsoft.com/en-us/powershell) scripting language
[`language_psql`](plugins/language_psql.lua?raw=1) | Syntax for the postgresql database access language
[`language_rust`](plugins/language_rust.lua?raw=1) | Syntax for the [Rust](https://rust-lang.org/) programming language
+[`language_ruby`](plugins/language_ruby.lua?raw=1) | Syntax for the [Ruby](https://www.ruby-lang.org/) programming language
+[`language sass`](plugins/language_sass.lua?raw=1) | Syntax for the [Sass](https://sass-lang.com/) CSS preprocessor
[`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language
[`language_teal`](plugins/language_teal.lua?raw=1) | Syntax for the [Teal](https://github.com/teal-language/tl) programming language, a typed dialect of Lua.
[`language_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language
[`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language
-[`lastproject`](plugins/lastproject.lua?raw=1) | Loads the last loaded project if lite is launched without any arguments
+[`language_zig`](plugins/language_zig.lua?raw=1) | Syntax for the [Zig](https://ziglang.org/) programming language
+~~[`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) | Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.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))*
[`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt`
[`markers`](plugins/markers.lua?raw=1) | Add markers to docs and jump between them quickly *([screenshot](https://user-images.githubusercontent.com/3920290/82252149-5faaa200-9946-11ea-9199-bea2efb7ee23.png))*
+[`memoryusage`](plugins/memoryusage.lua?raw=1) | Show memory usage in the status view
[`motiontrail`](plugins/motiontrail.lua?raw=1) | Adds a motion-trail to the caret *([screenshot](https://user-images.githubusercontent.com/3920290/83256814-085ccb00-a1ab-11ea-9e35-e6633cbed1a9.gif))*
[`nagbar`](https://github.com/takase1121/lite-nagbar)* | consistent and _beautiful_ confirmation dialogs for lite and lite-xl *([gif](https://raw.githubusercontent.com/takase1121/lite-nagbar/master/assets/preview.gif))*
[`openfilelocation`](plugins/openfilelocation.lua?raw=1) | Opens the parent directory of the current file in the file manager
[`openselected`](plugins/openselected.lua?raw=1) | Opens the selected filename or url
-[`projectmanager`](plugins/projectmanager.lua?raw=1) | Save projects and load/reload them quickly
+~~[`projectmanager`](plugins/projectmanager.lua?raw=1)~~ | Integrated in lite-xl with improvements ~~Save projects and load/reload them quickly~~
[`rainbowparen`](plugins/rainbowparen.lua?raw=1) | Show nesting of parentheses with rainbow colours
-[`scale`](plugins/scale.lua?raw=1) | Provides support for dynamically adjusting the scale of the code font / UI (`ctrl+-`, `ctrl+=`)
+[`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+=`)
[`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))*
[`sort`](plugins/sort.lua?raw=1) | Sorts selected lines alphabetically
@@ -92,8 +105,9 @@ Plugin | Description
[`tabnumbers`](plugins/tabnumbers.lua?raw=1) | Displays tab numbers from 1–9 next to their names *([screenshot](https://user-images.githubusercontent.com/16415678/101285362-007a8500-37e5-11eb-869b-c10eb9d9d902.png))
[`theme16`](https://github.com/monolifed/theme16)* | Theme manager with base16 themes
[`themescheduler`](https://github.com/BenStigsen/lite-config/blob/main/plugins/themescheduler.lua?raw=1) | Schedule themes to be used at certain times
+[`themeselect`](plugins/themeselect.lua?raw=1) | Select a theme based on filename of active document
[`titleize`](plugins/titleize.lua?raw=1) | Titleizes selected string (`hello world` => `Hello World`)
[`todotreeview`](https://github.com/drmargarido/TodoTreeView)* | Todo tree viewer for annotations in code like `TODO`, `BUG`, `FIX`, `IMPROVEMENT`
[`togglesnakecamel`](plugins/togglesnakecamel.lua?raw=1) | Toggles symbols between `snake_case` and `camelCase`
[`unboundedscroll`](plugins/unboundedscroll.lua?raw=1) | Allows scrolling outside the bounds of a document
-[`workspace`](plugins/workspace.lua?raw=1) | Retains project's layout and open documents between sessions
+~~[`workspace`](plugins/workspace.lua?raw=1)~~ | Integrated in lite-xl ~~Retains project's layout and open documents between sessions~~
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua
index 243e00b..7af2209 100644
--- a/plugins/autoinsert.lua
+++ b/plugins/autoinsert.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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
new file mode 100644
index 0000000..2759ba6
--- /dev/null
+++ b/plugins/autosave.lua
@@ -0,0 +1,46 @@
+-- mod-version:1 -- lite-xl 1.16
+local core = require "core"
+local config = require "core.config"
+local Doc = require "core.doc"
+local DocView = require "core.docview"
+local command = require "core.command"
+-- 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.autosave_timeout = 1
+
+
+local function loop_for_save()
+ while looping do
+ if os.difftime(os.time(), last_keypress) >= config.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)
+ end
+end
+
+
+local function updatepress()
+ -- set last keypress time to now
+ last_keypress = os.time()
+ -- put loop in coroutine so it doesn't lag out this script
+ if not looping then
+ looping = true
+ core.add_thread(loop_for_save)
+ end
+end
+
+
+function Doc:on_text_change(type)
+ -- check if file is saved
+ if self.filename then
+ updatepress()
+ end
+ return on_text_change(type)
+end
diff --git a/plugins/autowrap.lua b/plugins/autowrap.lua
index 85d4c24..1d5d08d 100644
--- a/plugins/autowrap.lua
+++ b/plugins/autowrap.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
require "plugins.reflow"
local config = require "core.config"
local command = require "core.command"
diff --git a/plugins/bigclock.lua b/plugins/bigclock.lua
index e35cdbe..ac44c9f 100644
--- a/plugins/bigclock.lua
+++ b/plugins/bigclock.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local style = require "core.style"
local command = require "core.command"
@@ -29,8 +30,8 @@ end
function ClockView:update_fonts()
local size = math.floor(self.size.x * 0.15 / 15) * 15 * config.bigclock_scale
if self.font_size ~= size then
- self.time_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", size)
- self.date_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", size * 0.3)
+ self.time_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", size)
+ self.date_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", size * 0.3)
self.font_size = size
collectgarbage()
end
diff --git a/plugins/bracketmatch.lua b/plugins/bracketmatch.lua
index 4253de7..e6a740d 100644
--- a/plugins/bracketmatch.lua
+++ b/plugins/bracketmatch.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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 1921467..c60c2dd 100644
--- a/plugins/centerdoc.lua
+++ b/plugins/centerdoc.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local config = require "core.config"
local DocView = require "core.docview"
diff --git a/plugins/closeconfirmx.lua b/plugins/closeconfirmx.lua
deleted file mode 100644
index 805fe3b..0000000
--- a/plugins/closeconfirmx.lua
+++ /dev/null
@@ -1,54 +0,0 @@
--- CloseConfirmX plugin for lite text editor
--- implementation by chekoopa
-
-local core = require "core"
-local config = require "core.config"
-
-config.closeconfirmx_use_legacy = false
-config.closeconfirmx_use_short_name = true
-
-local legacy_confirm = core.confirm_close_all
-
-local function commandful_confirm()
- local dirty_count = 0
- local dirty_name
- for _, doc in ipairs(core.docs) do
- if doc:is_dirty() then
- dirty_count = dirty_count + 1
- dirty_name = doc:get_name()
- end
- end
- if dirty_count > 0 then
- local text
- if dirty_count == 1 then
- if config.closeconfirmx_use_short_name then
- dirty_name = dirty_name:match("[^/%\\]*$")
- end
- text = string.format("Unsaved changes in \"%s\"; Confirm Exit", dirty_name)
- else
- text = string.format("Unsaved changes in %d docs; Confirm Exit", dirty_count)
- end
- core.command_view:enter(text, function(_, item)
- if item.text:match("^[cC]") then
- core.quit(true)
- end
- end, function(text)
- local items = {}
- if not text:find("^[^sS]") then table.insert(items, "Stay here") end
- if not text:find("^[^cC]") then table.insert(items, "Close Without Saving") end
- return items
- end)
- -- as we delegate a choice inside the callback,
- return false
- end
- return true
-end
-
-function core.confirm_close_all()
- if config.closeconfirmx_use_legacy then
- return legacy_confirm()
- else
- return commandful_confirm()
- end
-end
-
diff --git a/plugins/colorpreview.lua b/plugins/colorpreview.lua
index dca419c..370d1d8 100644
--- a/plugins/colorpreview.lua
+++ b/plugins/colorpreview.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local common = require "core.common"
local DocView = require "core.docview"
diff --git a/plugins/copyfilelocation.lua b/plugins/copyfilelocation.lua
index d365240..9f33ee1 100644
--- a/plugins/copyfilelocation.lua
+++ b/plugins/copyfilelocation.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local config = require "core.config"
@@ -6,12 +7,11 @@ local config = require "core.config"
command.add("core.docview", {
["copy-file-location:copy-file-location"] = function()
local doc = core.active_view.doc
- if not doc.filename then
+ if not doc.abs_filename then
core.error "Cannot copy location of unsaved doc"
return
end
- local filename = system.absolute_path(doc.filename)
- core.log("Copying to clipboard \"%s\"", filename)
- system.set_clipboard(filename)
+ core.log("Copying to clipboard \"%s\"", doc.abs_filename)
+ system.set_clipboard(doc.abs_filename)
end
})
diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua
index 518f0a9..9ce425a 100644
--- a/plugins/datetimestamps.lua
+++ b/plugins/datetimestamps.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local config = require "core.config"
local command = require "core.command"
diff --git a/plugins/detectindent.lua b/plugins/detectindent.lua
deleted file mode 100644
index 9c473b5..0000000
--- a/plugins/detectindent.lua
+++ /dev/null
@@ -1,64 +0,0 @@
-local core = require "core"
-local command = require "core.command"
-local config = require "core.config"
-local DocView = require "core.docview"
-local Doc = require "core.doc"
-
-local cache = setmetatable({}, { __mode = "k" })
-
-
-local function detect_indent(doc)
- for _, text in ipairs(doc.lines) do
- local str = text:match("^ +")
- if str then return "soft", #str end
- local str = text:match("^\t+")
- if str then return "hard" end
- end
-end
-
-
-local function update_cache(doc)
- local type, size = detect_indent(doc)
- if type then
- cache[doc] = { type = type, size = size }
- end
-end
-
-
-local new = Doc.new
-function Doc:new(...)
- new(self, ...)
- update_cache(self)
-end
-
-local clean = Doc.clean
-function Doc:clean(...)
- clean(self, ...)
- update_cache(self)
-end
-
-
-local function with_indent_override(doc, fn, ...)
- local c = cache[doc]
- if not c then
- return fn(...)
- end
- local type, size = config.tab_type, config.indent_size
- config.tab_type, config.indent_size = c.type, c.size or config.indent_size
- local r1, r2, r3 = fn(...)
- config.tab_type, config.indent_size = type, size
- return r1, r2, r3
-end
-
-
-local perform = command.perform
-function command.perform(...)
- return with_indent_override(core.active_view.doc, perform, ...)
-end
-
-
-local draw = DocView.draw
-function DocView:draw(...)
- return with_indent_override(self.doc, draw, self, ...)
-end
-
diff --git a/plugins/dragdropselected.lua b/plugins/dragdropselected.lua
index a2ce67f..aeacbd3 100644
--- a/plugins/dragdropselected.lua
+++ b/plugins/dragdropselected.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
--[[
dragdropselected.lua
provides basic drag and drop of selected text (in same document)
diff --git a/plugins/drawwhitespace.lua b/plugins/drawwhitespace.lua
deleted file mode 100644
index c6ed07d..0000000
--- a/plugins/drawwhitespace.lua
+++ /dev/null
@@ -1,37 +0,0 @@
-local common = require "core.common"
-local config = require "core.config"
-local style = require "core.style"
-local DocView = require "core.docview"
-local command = require "core.command"
-
--- originally written by luveti
-
-config.whitespace_map = { [" "] = "·", ["\t"] = "»" }
-config.draw_whitespace = true
-
-local draw_line_text = DocView.draw_line_text
-
-function DocView:draw_line_text(idx, x, y)
- draw_line_text(self, idx, x, y)
- if not config.draw_whitespace then return end
-
- local text = self.doc.lines[idx]
- local tx, ty = x, y + self:get_line_text_y_offset()
- local font = self:get_font()
- local color = style.whitespace or style.syntax.comment
- local map = config.whitespace_map
-
- for chr in common.utf8_chars(text) do
- local rep = map[chr]
- if rep then
- renderer.draw_text(font, rep, tx, ty, color)
- end
- tx = tx + font:get_width(chr)
- end
-end
-
-command.add("core.docview", {
- ["draw-whitespace:toggle"] = function() config.draw_whitespace = not config.draw_whitespace end,
- ["draw-whitespace:disable"] = function() config.draw_whitespace = false end,
- ["draw-whitespace:enable"] = function() config.draw_whitespace = true end,
-})
diff --git a/plugins/eval.lua b/plugins/eval.lua
index 54e08ba..ae13a14 100644
--- a/plugins/eval.lua
+++ b/plugins/eval.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
diff --git a/plugins/exec.lua b/plugins/exec.lua
index fe87afc..d1ed6a8 100644
--- a/plugins/exec.lua
+++ b/plugins/exec.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
diff --git a/plugins/ghmarkdown.lua b/plugins/ghmarkdown.lua
index 0f49c02..6e81daa 100644
--- a/plugins/ghmarkdown.lua
+++ b/plugins/ghmarkdown.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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 a58fd0f..904cd38 100644
--- a/plugins/gitstatus.lua
+++ b/plugins/gitstatus.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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 11c90b9..fd204a6 100644
--- a/plugins/gofmt.lua
+++ b/plugins/gofmt.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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 206bd23..5ed23b3 100644
--- a/plugins/hidelinenumbers.lua
+++ b/plugins/hidelinenumbers.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local style = require "core.style"
local DocView = require "core.docview"
diff --git a/plugins/hidestatus.lua b/plugins/hidestatus.lua
index 5c0bb15..fc687cb 100644
--- a/plugins/hidestatus.lua
+++ b/plugins/hidestatus.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local command = require "core.command"
local StatusView = require "core.statusview"
diff --git a/plugins/inanimate.lua b/plugins/inanimate.lua
deleted file mode 100644
index a01aa40..0000000
--- a/plugins/inanimate.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local core = require "core"
-local View = require "core.view"
-
-function View:move_towards(t, k, dest)
- if type(t) ~= "table" then
- return self:move_towards(self, t, k, dest)
- end
- if t[k] ~= dest then
- core.redraw = true
- end
- t[k] = dest
-end
diff --git a/plugins/indentguide.lua b/plugins/indentguide.lua
index daf7d8b..f1b7cf7 100644
--- a/plugins/indentguide.lua
+++ b/plugins/indentguide.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local style = require "core.style"
local config = require "core.config"
local DocView = require "core.docview"
@@ -34,12 +35,16 @@ local draw_line_text = DocView.draw_line_text
function DocView:draw_line_text(idx, x, y)
local spaces = get_line_indent_guide_spaces(self.doc, idx)
- local sw = self:get_font():get_width(" ")
local w = math.ceil(1 * SCALE)
local h = self:get_line_height()
- for i = 0, spaces - 1, config.indent_size do
+ local sspaces = ""
+ local font = self:get_font()
+ local ss = font:subpixel_scale()
+ for _ = 0, spaces - 1, config.indent_size do
local color = style.guide or style.selection
- renderer.draw_rect(x + sw * i, y, w, h, color)
+ local sw = font:get_width_subpixel(sspaces) / ss
+ renderer.draw_rect(x + sw, y, w, h, color)
+ sspaces = sspaces .. (' '):rep(config.indent_size)
end
draw_line_text(self, idx, x, y)
end
diff --git a/plugins/language_angelscript.lua b/plugins/language_angelscript.lua
index 8c39cff..d34a0eb 100644
--- a/plugins/language_angelscript.lua
+++ b/plugins/language_angelscript.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_batch.lua b/plugins/language_batch.lua
index 8caad59..441a367 100644
--- a/plugins/language_batch.lua
+++ b/plugins/language_batch.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
-- batch syntax for lite <liqube>
diff --git a/plugins/language_cmake.lua b/plugins/language_cmake.lua
index 78354e1..9f4df2f 100644
--- a/plugins/language_cmake.lua
+++ b/plugins/language_cmake.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_cpp.lua b/plugins/language_cpp.lua
index 2b2fce5..bb1f347 100644
--- a/plugins/language_cpp.lua
+++ b/plugins/language_cpp.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
pcall(require, "plugins.language_c")
local syntax = require "core.syntax"
@@ -11,7 +12,6 @@ syntax.add {
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
- { pattern = { "#", "[^\\]\n" }, type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "-?0x%x+", type = "number" },
@@ -19,7 +19,7 @@ syntax.add {
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
- { pattern = "[%a_][%w_]*", type = "symbol" },
+ { pattern = "#[%a_][%w_]*", type = "symbol" },
},
symbols = {
["alignof"] = "keyword",
@@ -87,7 +87,7 @@ syntax.add {
["continue"] = "keyword",
["return"] = "keyword",
["goto"] = "keyword",
- ["struct"] = "keyword",
+ ["struct"] = "keyword2",
["union"] = "keyword",
["typedef"] = "keyword",
["enum"] = "keyword",
@@ -117,5 +117,16 @@ syntax.add {
["char16_t"] = "keyword2",
["char32_t"] = "keyword2",
["NULL"] = "literal",
+ ["#include"] = "keyword",
+ ["#if"] = "keyword",
+ ["#ifdef"] = "keyword",
+ ["#ifndef"] = "keyword",
+ ["#else"] = "keyword",
+ ["#elseif"] = "keyword",
+ ["#endif"] = "keyword",
+ ["#define"] = "keyword",
+ ["#warning"] = "keyword",
+ ["#error"] = "keyword",
+ ["#pragma"] = "keyword",
},
}
diff --git a/plugins/language_csharp.lua b/plugins/language_csharp.lua
index c40009c..b6ee8e0 100644
--- a/plugins/language_csharp.lua
+++ b/plugins/language_csharp.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_d.lua b/plugins/language_d.lua
index 4597943..a054de6 100644
--- a/plugins/language_d.lua
+++ b/plugins/language_d.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_dart.lua b/plugins/language_dart.lua
index 5083fb2..2e3cfc3 100644
--- a/plugins/language_dart.lua
+++ b/plugins/language_dart.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_elixir.lua b/plugins/language_elixir.lua
index f87fad9..8dd7cc9 100644
--- a/plugins/language_elixir.lua
+++ b/plugins/language_elixir.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_elm.lua b/plugins/language_elm.lua
index 4f449a0..c5f2223 100644
--- a/plugins/language_elm.lua
+++ b/plugins/language_elm.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_fe.lua b/plugins/language_fe.lua
index f97e73b..f1aeef4 100644
--- a/plugins/language_fe.lua
+++ b/plugins/language_fe.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_fennel.lua b/plugins/language_fennel.lua
index 7320e91..fbf1ba6 100644
--- a/plugins/language_fennel.lua
+++ b/plugins/language_fennel.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
-- 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 e301354..c638ab9 100644
--- a/plugins/language_gdscript.lua
+++ b/plugins/language_gdscript.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
-- 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 da69ebd..1f57a06 100644
--- a/plugins/language_glsl.lua
+++ b/plugins/language_glsl.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local style = require "core.style"
local common = require "core.common"
diff --git a/plugins/language_go.lua b/plugins/language_go.lua
index dffbaf9..76289bd 100644
--- a/plugins/language_go.lua
+++ b/plugins/language_go.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_hlsl.lua b/plugins/language_hlsl.lua
index 1444ef4..45128d6 100644
--- a/plugins/language_hlsl.lua
+++ b/plugins/language_hlsl.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local style = require "core.style"
local common = require "core.common"
diff --git a/plugins/language_hs.lua b/plugins/language_hs.lua
index f0bf378..5f69a5a 100644
--- a/plugins/language_hs.lua
+++ b/plugins/language_hs.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_java.lua b/plugins/language_java.lua
index 1d9e12d..42ad147 100644
--- a/plugins/language_java.lua
+++ b/plugins/language_java.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_jiyu.lua b/plugins/language_jiyu.lua
index 1cf94dc..a433170 100644
--- a/plugins/language_jiyu.lua
+++ b/plugins/language_jiyu.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_jsx.lua b/plugins/language_jsx.lua
new file mode 100644
index 0000000..2648c68
--- /dev/null
+++ b/plugins/language_jsx.lua
@@ -0,0 +1,69 @@
+-- mod-version:1 -- lite-xl 1.16
+-- 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 {
+ files = { "%.jsx$" },
+ comment = "//",
+ patterns = {
+ { pattern = "//.-\n", type = "comment" },
+ { pattern = { "/%*", "%*/" }, type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = { "`", "`", '\\' }, type = "string" },
+ { pattern = "0x[%da-fA-F]+", type = "number" },
+ { pattern = "-?%d+[%d%.eE]*", type = "number" },
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["async"] = "keyword",
+ ["await"] = "keyword",
+ ["break"] = "keyword",
+ ["case"] = "keyword",
+ ["catch"] = "keyword",
+ ["class"] = "keyword",
+ ["const"] = "keyword",
+ ["continue"] = "keyword",
+ ["debugger"] = "keyword",
+ ["default"] = "keyword",
+ ["delete"] = "keyword",
+ ["do"] = "keyword",
+ ["else"] = "keyword",
+ ["export"] = "keyword",
+ ["extends"] = "keyword",
+ ["finally"] = "keyword",
+ ["for"] = "keyword",
+ ["function"] = "keyword",
+ ["get"] = "keyword",
+ ["if"] = "keyword",
+ ["import"] = "keyword",
+ ["in"] = "keyword",
+ ["instanceof"] = "keyword",
+ ["let"] = "keyword",
+ ["new"] = "keyword",
+ ["return"] = "keyword",
+ ["set"] = "keyword",
+ ["static"] = "keyword",
+ ["super"] = "keyword",
+ ["switch"] = "keyword",
+ ["throw"] = "keyword",
+ ["try"] = "keyword",
+ ["typeof"] = "keyword",
+ ["var"] = "keyword",
+ ["void"] = "keyword",
+ ["while"] = "keyword",
+ ["with"] = "keyword",
+ ["yield"] = "keyword",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["null"] = "literal",
+ ["undefined"] = "literal",
+ ["arguments"] = "keyword2",
+ ["Infinity"] = "keyword2",
+ ["NaN"] = "keyword2",
+ ["this"] = "keyword2",
+ },
+}
diff --git a/plugins/language_liquid.lua b/plugins/language_liquid.lua
new file mode 100644
index 0000000..5cc7573
--- /dev/null
+++ b/plugins/language_liquid.lua
@@ -0,0 +1,144 @@
+-- mod-version:1 -- lite-xl 1.16
+local syntax = require "core.syntax"
+
+local liquid_syntax = {
+ patterns = {
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?%d+[%d%.]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "%w+", type = "symbol" },
+ },
+ symbols = {
+ ["abs"] = "keyword2",
+ ["and"] = "operator",
+ ["append"] = "keyword2",
+ ["assign"] = "keyword",
+ ["at_least"] = "keyword2",
+ ["at_most"] = "keyword2",
+ ["break"] = "keyword",
+ ["camelcase"] = "keyword2",
+ ["capitalize"] = "keyword2",
+ ["capture"] = "keyword",
+ ["endcapture"] = "keyword",
+ ["case"] = "keyword",
+ ["ceil"] = "keyword2",
+ ["comment"] = "keyword",
+ ["endcomment"] = "keyword",
+ ["concat"] = "keyword2",
+ ["contains"] = "operator",
+ ["cycle"] = "keyword",
+ ["date"] = "keyword2",
+ ["decrement"] = "keyword",
+ ["default"] = "keyword2",
+ ["divided_by"] = "keyword2",
+ ["downcase"] = "keyword2",
+ ["else"] = "keyword",
+ ["elsif"] = "keyword",
+ ["false"] = "literal",
+ ["first"] = "keyword2",
+ ["floor"] = "keyword2",
+ ["for"] = "keyword",
+ ["endfor"] = "keyword",
+ ["forloop"] = "literal",
+ ["handleize"] = "keyword2",
+ ["handle"] = "keyword2",
+ ["if"] = "keyword",
+ ["endif"] = "keyword",
+ ["increment"] = "keyword",
+ ["index0"] = "literal",
+ ["index"] = "literal",
+ ["in"] = "operator",
+ ["join"] = "keyword2",
+ ["last"] = "keyword2",
+ ["length"] = "literal",
+ ["limit"] = "keyword",
+ ["lstrip"] = "keyword",
+ ["map"] = "keyword2",
+ ["minus"] = "keyword2",
+ ["modulo"] = "keyword2",
+ ["nil"] = "literal",
+ ["null"] = "literal",
+ ["offset"] = "keyword2",
+ ["or"] = "operator",
+ ["pluralize"] = "keyword2",
+ ["plus"] = "keyword2",
+ ["prepend"] = "keyword2",
+ ["raw"] = "keyword",
+ ["endraw"] = "keyword",
+ ["removefirst"] = "keyword2",
+ ["remove"] = "keyword2",
+ ["replacefirst"] = "keyword2",
+ ["replace"] = "keyword2",
+ ["reversed"] = "operator",
+ ["reverse"] = "keyword2",
+ ["rindex0"] = "literal",
+ ["rindex"] = "literal",
+ ["round"] = "keyword2",
+ ["rstrip"] = "keyword2",
+ ["size"] = "keyword2",
+ ["slice"] = "keyword2",
+ ["sort"] = "keyword2",
+ ["split"] = "keyword2",
+ ["strip"] = "keyword2",
+ ["strip_newlines"] = "keyword2",
+ ["times"] = "keyword2",
+ ["true"] = "literal",
+ ["truncate"] = "keyword2",
+ ["truncatewords"] = "keyword2",
+ ["uniq"] = "keyword2",
+ ["unless"] = "keyword",
+ ["endunless"] = "keyword",
+ ["upcase"] = "keyword2",
+ ["when"] = "keyword",
+ ["where"] = "keyword2"
+
+ },
+}
+
+syntax.add {
+ files = { "%.liquid?$" },
+ patterns = {
+ { pattern = { "{%%", "%%}" }, syntax = liquid_syntax, type = "function" },
+ { pattern = { "{{", "}}" }, syntax = liquid_syntax, type = "function" },
+ {
+ 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]>"
+ },
+ syntax = ".js",
+ type = "function"
+ },
+ {
+ pattern = {
+ "<%s*[sS][cC][rR][iI][pP][tT]%s*>",
+ "<%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*>"
+ },
+ syntax = ".css",
+ type = "function"
+ },
+ { pattern = { "<!%-%-", "%-%->" }, type = "comment" },
+ { pattern = { '%f[^>][^<]', '%f[<{]' }, type = "normal" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "0x[%da-fA-F]+", type = "number" },
+ { pattern = "-?%d+[%d%.]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
+ { pattern = "%f[^<][%a_][%w_]*", type = "function" },
+ { pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "keyword" },
+ { pattern = "[/<>=]", type = "operator" }
+ },
+ symbols = {},
+}
+
diff --git a/plugins/language_make.lua b/plugins/language_make.lua
index f586a05..21e9df0 100644
--- a/plugins/language_make.lua
+++ b/plugins/language_make.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_meson.lua b/plugins/language_meson.lua
index ab6be17..c1aa4b1 100644
--- a/plugins/language_meson.lua
+++ b/plugins/language_meson.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
@@ -5,7 +6,6 @@ syntax.add {
comment = "#",
patterns = {
{ pattern = { "#", "\n" }, type = "comment" },
- { pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = { "'''", "'''" }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
diff --git a/plugins/language_moon.lua b/plugins/language_moon.lua
index 4817743..ef8d3bd 100644
--- a/plugins/language_moon.lua
+++ b/plugins/language_moon.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_nim.lua b/plugins/language_nim.lua
index af230e4..d42cb4a 100644
--- a/plugins/language_nim.lua
+++ b/plugins/language_nim.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
local patterns = {}
diff --git a/plugins/language_objc.lua b/plugins/language_objc.lua
index 221e5c3..c2b2eee 100644
--- a/plugins/language_objc.lua
+++ b/plugins/language_objc.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_odin.lua b/plugins/language_odin.lua
index c3413f2..52a24e0 100644
--- a/plugins/language_odin.lua
+++ b/plugins/language_odin.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_perl.lua b/plugins/language_perl.lua
new file mode 100644
index 0000000..1332464
--- /dev/null
+++ b/plugins/language_perl.lua
@@ -0,0 +1,259 @@
+-- mod-version:1 -- lite-xl 1.16
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.pm$", "%.pl$" },
+ headers = "^#!.*[ /]perl",
+ comment = "#",
+ patterns = {
+ { pattern = "%#.-\n", type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ -- until we can get this workign with s///, just don't do any of them.
+ -- { pattern = { '/', '/', '\\' }, type = "string" },
+ { pattern = "-?%d+[%d%.eE]*", type = "number" },
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[%@%$%*]+[%a_][%w_]*", type = "keyword2" },
+ { pattern = "%--[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["-A"] = "keyword",
+ ["END"] = "keyword",
+ ["length"] = "keyword",
+ ["setpgrp"] = "keyword",
+ ["-B"] = "keyword",
+ ["endgrent"] = "keyword",
+ ["link"] = "keyword",
+ ["setpriority"] = "keyword",
+ ["-b"] = "keyword",
+ ["endhostent"] = "keyword",
+ ["listen"] = "keyword",
+ ["setprotoent"] = "keyword",
+ ["-C"] = "keyword",
+ ["endnetent"] = "keyword",
+ ["local"] = "keyword",
+ ["setpwent"] = "keyword",
+ ["-c"] = "keyword",
+ ["endprotoent"] = "keyword",
+ ["localtime"] = "keyword",
+ ["setservent"] = "keyword",
+ ["-d"] = "keyword",
+ ["endpwent"] = "keyword",
+ ["log"] = "keyword",
+ ["setsockopt"] = "keyword",
+ ["-e"] = "keyword",
+ ["endservent"] = "keyword",
+ ["lstat"] = "keyword",
+ ["shift"] = "keyword",
+ ["-f"] = "keyword",
+ ["eof$"] = "keyword",
+ ["map"] = "keyword",
+ ["shmctl"] = "keyword",
+ ["-g"] = "keyword",
+ ["eval"] = "keyword",
+ ["mkdir"] = "keyword",
+ ["shmget"] = "keyword",
+ ["-k"] = "keyword",
+ ["exec"] = "keyword",
+ ["msgctl"] = "keyword",
+ ["shmread"] = "keyword",
+ ["-l"] = "keyword",
+ ["exists"] = "keyword",
+ ["msgget"] = "keyword",
+ ["shmwrite"] = "keyword",
+ ["-M"] = "keyword",
+ ["exit"] = "keyword",
+ ["msgrcv"] = "keyword",
+ ["shutdown"] = "keyword",
+ ["-O"] = "keyword",
+ ["fcntl"] = "keyword",
+ ["msgsnd"] = "keyword",
+ ["sin"] = "keyword",
+ ["-o"] = "keyword",
+ ["fileno"] = "keyword",
+ ["my"] = "keyword",
+ ["sleep"] = "keyword",
+ ["-p"] = "keyword",
+ ["flock"] = "keyword",
+ ["next"] = "keyword",
+ ["socket"] = "keyword",
+ ["package"] = "keyword",
+ ["-r"] = "keyword",
+ ["fork"] = "keyword",
+ ["not"] = "keyword",
+ ["socketpair"] = "keyword",
+ ["-R"] = "keyword",
+ ["format"] = "keyword",
+ ["oct"] = "keyword",
+ ["sort"] = "keyword",
+ ["-S"] = "keyword",
+ ["formline"] = "keyword",
+ ["open"] = "keyword",
+ ["splice"] = "keyword",
+ ["-s"] = "keyword",
+ ["getc"] = "keyword",
+ ["opendir"] = "keyword",
+ ["split"] = "keyword",
+ ["-T"] = "keyword",
+ ["getgrent"] = "keyword",
+ ["ord"] = "keyword",
+ ["sprintf"] = "keyword",
+ ["-t"] = "keyword",
+ ["getgrgid"] = "keyword",
+ ["our"] = "keyword",
+ ["sqrt"] = "keyword",
+ ["-u"] = "keyword",
+ ["getgrnam"] = "keyword",
+ ["pack"] = "keyword",
+ ["srand"] = "keyword",
+ ["-w"] = "keyword",
+ ["gethostbyaddr"] = "keyword",
+ ["pipe"] = "keyword",
+ ["stat"] = "keyword",
+ ["-W"] = "keyword",
+ ["gethostbyname"] = "keyword",
+ ["pop"] = "keyword",
+ ["state"] = "keyword",
+ ["-X"] = "keyword",
+ ["gethostent"] = "keyword",
+ ["pos"] = "keyword",
+ ["study"] = "keyword",
+ ["-x"] = "keyword",
+ ["getlogin"] = "keyword",
+ ["print"] = "keyword",
+ ["substr"] = "keyword",
+ ["-z"] = "keyword",
+ ["getnetbyaddr"] = "keyword",
+ ["printf"] = "keyword",
+ ["symlink"] = "keyword",
+ ["abs"] = "keyword",
+ ["getnetbyname"] = "keyword",
+ ["prototype"] = "keyword",
+ ["syscall"] = "keyword",
+ ["accept"] = "keyword",
+ ["getnetent"] = "keyword",
+ ["push"] = "keyword",
+ ["sysopen"] = "keyword",
+ ["alarm"] = "keyword",
+ ["getpeername"] = "keyword",
+ ["quotemeta"] = "keyword",
+ ["sysread"] = "keyword",
+ ["atan2"] = "keyword",
+ ["getpgrp"] = "keyword",
+ ["rand"] = "keyword",
+ ["sysseek"] = "keyword",
+ ["AUTOLOAD"] = "keyword",
+ ["getppid"] = "keyword",
+ ["read"] = "keyword",
+ ["system"] = "keyword",
+ ["BEGIN"] = "keyword",
+ ["getpriority"] = "keyword",
+ ["readdir"] = "keyword",
+ ["syswrite"] = "keyword",
+ ["bind"] = "keyword",
+ ["getprotobyname"] = "keyword",
+ ["readline"] = "keyword",
+ ["tell"] = "keyword",
+ ["binmode"] = "keyword",
+ ["getprotobynumber"] = "keyword",
+ ["SUPER"] = "keyword",
+ ["readlink"] = "keyword",
+ ["telldir"] = "keyword",
+ ["bless"] = "keyword",
+ ["sub"] = "keyword",
+ ["getprotoent"] = "keyword",
+ ["readpipe"] = "keyword",
+ ["tie"] = "keyword",
+ ["getpwent"] = "keyword",
+ ["recv"] = "keyword",
+ ["tied"] = "keyword",
+ ["caller"] = "keyword",
+ ["getpwnam"] = "keyword",
+ ["redo"] = "keyword",
+ ["time"] = "keyword",
+ ["chdir"] = "keyword",
+ ["getpwuid"] = "keyword",
+ ["ref"] = "keyword",
+ ["times"] = "keyword",
+ ["CHECK"] = "keyword",
+ ["getservbyname"] = "keyword",
+ ["rename"] = "keyword",
+ ["truncate"] = "keyword",
+ ["chmod"] = "keyword",
+ ["getservbyport"] = "keyword",
+ ["require"] = "keyword",
+ ["uc"] = "keyword",
+ ["chomp"] = "keyword",
+ ["getservent"] = "keyword",
+ ["reset"] = "keyword",
+ ["ucfirst"] = "keyword",
+ ["chop"] = "keyword",
+ ["getsockname"] = "keyword",
+ ["return"] = "keyword",
+ ["umask"] = "keyword",
+ ["chown"] = "keyword",
+ ["getsockopt"] = "keyword",
+ ["reverse"] = "keyword",
+ ["undef"] = "keyword",
+ ["chr"] = "keyword",
+ ["glob"] = "keyword",
+ ["rewinddir"] = "keyword",
+ ["UNITCHECK"] = "keyword",
+ ["chroot"] = "keyword",
+ ["gmtime"] = "keyword",
+ ["rindex"] = "keyword",
+ ["unlink"] = "keyword",
+ ["close"] = "keyword",
+ ["goto"] = "keyword",
+ ["rmdir"] = "keyword",
+ ["unpack"] = "keyword",
+ ["closedir"] = "keyword",
+ ["grep"] = "keyword",
+ ["say"] = "keyword",
+ ["unshift"] = "keyword",
+ ["connect"] = "keyword",
+ ["hex"] = "keyword",
+ ["scalar"] = "keyword",
+ ["untie"] = "keyword",
+ ["cos"] = "keyword",
+ ["index"] = "keyword",
+ ["seek"] = "keyword",
+ ["use"] = "keyword",
+ ["crypt"] = "keyword",
+ ["INIT"] = "keyword",
+ ["seekdir"] = "keyword",
+ ["utime"] = "keyword",
+ ["dbmclose"] = "keyword",
+ ["int"] = "keyword",
+ ["select"] = "keyword",
+ ["values"] = "keyword",
+ ["dbmopen"] = "keyword",
+ ["ioctl"] = "keyword",
+ ["semctl"] = "keyword",
+ ["vec"] = "keyword",
+ ["defined"] = "keyword",
+ ["join"] = "keyword",
+ ["semget"] = "keyword",
+ ["wait"] = "keyword",
+ ["delete"] = "keyword",
+ ["keys"] = "keyword",
+ ["semop"] = "keyword",
+ ["waitpid"] = "keyword",
+ ["DESTROY"] = "keyword",
+ ["kill"] = "keyword",
+ ["send"] = "keyword",
+ ["wantarray"] = "keyword",
+ ["die"] = "keyword",
+ ["last"] = "keyword",
+ ["setgrent"] = "keyword",
+ ["warn"] = "keyword",
+ ["dump"] = "keyword",
+ ["lc"] = "keyword",
+ ["sethostent"] = "keyword",
+ ["write"] = "keyword",
+ ["each"] = "keyword",
+ ["lcfirst"] = "keyword",
+ ["setnetent"] = "keyword"
+ }
+}
diff --git a/plugins/language_php.lua b/plugins/language_php.lua
index d6ed516..0db81a3 100644
--- a/plugins/language_php.lua
+++ b/plugins/language_php.lua
@@ -1,99 +1,70 @@
+-- mod-version:1 -- lite-xl 1.16
+--[[
+ language_php.lua
+ provides php syntax support allowing mixed html, css and js
+ version: 20210513_144200
+
+ Depends on plugin language_phps.lua version >= 20210512_181200
+--]]
local syntax = require "core.syntax"
syntax.add {
files = { "%.php$", "%.phtml" },
- headers = "^<%?php",
- comment = "//",
patterns = {
- { pattern = "//.-\n", type = "comment" },
- { pattern = "#.-\n", type = "comment" },
- { pattern = { "/%*", "%*/" }, type = "comment" },
- -- I dont know why the '//' are needed but I leave it here for now
- { pattern = { '"', '"', '\\' }, type = "string" },
- { pattern = { "'", "'", '\\' }, type = "string" },
- { pattern = "%\\x[%da-fA-F]+", type = "number" },
- { pattern = "-?%d+[%d%.eE]*", type = "number" },
- { pattern = "-?%.?%d+", type = "number" },
- { pattern = "[%.%+%-=/%*%^%%<>!~|&]", type = "operator" },
- { pattern = "[%a_][%w_]*%f[(]", type = "function" },
- { pattern = "[%a_][%w_]*", type = "symbol" },
- -- To indicate variables.
- { pattern = "%$", type = "operator" },
- },
- symbols = {
- ["return"] = "keyword",
- ["if"] = "keyword",
- ["else"] = "keyword",
- ["elseif"] = "keyword",
- ["endif"] = "keyword",
- ["declare"] = "keyword",
- ["enddeclare"] = "keyword",
- ["switch"] = "keyword",
- ["endswitch"] = "keyword",
- ["as"] = "keyword",
- ["do"] = "keyword",
- ["for"] = "keyword",
- ["endfor"] = "keyword",
- ["foreach"] = "keyword",
- ["endforeach"] = "keyword",
- ["while"] = "keyword",
- ["endwhile"] = "keyword",
- ["switch"] = "keyword",
- ["case"] = "keyword",
- ["continue"] = "keyword",
- ["default"] = "keyword",
- ["break"] = "keyword",
- ["exit"] = "keyword",
- ["goto"] = "keyword",
-
- ["catch"] = "keyword",
- ["throw"] = "keyword",
- ["try"] = "keyword",
- ["finally"] = "keyword",
-
- ["class"] = "keyword",
- ["trait"] = "keyword",
- ["interface"] = "keyword",
- ["public"] = "keyword",
- ["static"] = "keyword",
- ["protected"] = "keyword",
- ["private"] = "keyword",
- ["abstract"] = "keyword",
- ["final"] = "keyword",
-
- ["function"] = "keyword2",
- ["global"] = "keyword2",
- ["var"] = "keyword2",
- ["const"] = "keyword2",
- ["bool"] = "keyword2",
- ["boolean"] = "keyword2",
- ["int"] = "keyword2",
- ["integer"] = "keyword2",
- ["real"] = "keyword2",
- ["double"] = "keyword2",
- ["float"] = "keyword2",
- ["string"] = "keyword2",
- ["array"] = "keyword2",
- ["object"] = "keyword2",
- ["callable"] = "keyword2",
- ["iterable"] = "keyword2",
-
- ["namespace"] = "keyword2",
- ["extends"] = "keyword2",
- ["implements"] = "keyword2",
- ["instanceof"] = "keyword2",
- ["require"] = "keyword2",
- ["require_once"] = "keyword2",
- ["include"] = "keyword2",
- ["include_once"] = "keyword2",
- ["use"] = "keyword2",
- ["new"] = "keyword2",
- ["clone"] = "keyword2",
-
- ["true"] = "literal",
- ["false"] = "literal",
- ["NULL"] = "literal",
- ["parent"] = "literal",
- ["self"] = "literal",
+ {
+ pattern = {
+ "<%?php%s+",
+ "%?>"
+ },
+ syntax = ".phps",
+ type = "keyword2"
+ },
+ {
+ pattern = {
+ "<%?=?",
+ "%?>"
+ },
+ syntax = ".phps",
+ type = "keyword2"
+ },
+ {
+ 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]>"
+ },
+ syntax = ".js",
+ type = "function"
+ },
+ {
+ pattern = {
+ "<%s*[sS][cC][rR][iI][pP][tT]%s*>",
+ "<%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*>"
+ },
+ syntax = ".css",
+ type = "function"
+ },
+ { pattern = { "<!%-%-", "%-%->" }, type = "comment" },
+ { pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "0x[%da-fA-F]+", type = "number" },
+ { pattern = "-?%d+[%d%.]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" },
+ { pattern = "%f[^<][%a_][%w_]*", type = "function" },
+ { pattern = "%f[^<]/[%a_][%w_]*", type = "function" },
+ { pattern = "[%a_][%w_]*", type = "keyword" },
+ { pattern = "[/<>=]", type = "operator" },
},
+ symbols = {},
}
+
diff --git a/plugins/language_phps.lua b/plugins/language_phps.lua
new file mode 100644
index 0000000..7476a8f
--- /dev/null
+++ b/plugins/language_phps.lua
@@ -0,0 +1,140 @@
+-- mod-version:1 -- lite-xl 1.16
+--[[
+ language_phps.lua
+ complement to language_php.lua providing the php syntax support
+ version: 20210512_181200
+--]]
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.phps$" },
+ headers = "^<%?php",
+ comment = "//",
+ patterns = {
+ -- Attributes
+ { pattern = {"#%[", "%]"}, type = "normal" },
+ -- Comments
+ { pattern = "//.-\n", type = "comment" },
+ { pattern = "#.-\n", type = "comment" },
+ { pattern = { "/%*", "%*/" }, type = "comment" },
+ -- The '\\' is for escaping to work on " or '
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "0[bB][%d]+", type = "number" },
+ { pattern = "0[xX][%da-fA-F]+", type = "number" },
+ { pattern = "-?%d[%d_%.eE]*", type = "number" },
+ { pattern = "-?%.?%d+", type = "number" },
+ { pattern = "[%.%+%-=/%*%^%%<>!~|&%?:]", type = "operator" },
+ -- Variables
+ { pattern = "%$[%w_]+", type = "keyword2" },
+ -- Respect control structures, treat as keyword not function
+ { pattern = "if[%s]*%f[(]", type = "keyword" },
+ { pattern = "else[%s]*%f[(]", type = "keyword" },
+ { pattern = "elseif[%s]*%f[(]", type = "keyword" },
+ { pattern = "for[%s]*%f[(]", type = "keyword" },
+ { pattern = "foreach[%s]*%f[(]", type = "keyword" },
+ { pattern = "while[%s]*%f[(]", type = "keyword" },
+ { pattern = "catch[%s]*%f[(]", type = "keyword" },
+ { pattern = "switch[%s]*%f[(]", type = "keyword" },
+ { pattern = "match[%s]*%f[(]", type = "keyword" },
+ { pattern = "fn[%s]*%f[(]", type = "keyword" },
+ -- All functions that aren't control structures
+ { pattern = "[%a_][%w_]*[%s]*%f[(]", type = "function" },
+ -- Array type hint not added on symbols to also make it work
+ -- as a function call
+ { pattern = "array", type = "literal" },
+ -- Match static or namespace container on sub element access
+ { pattern = "[%a_][%w_]*[%s]*%f[:]", type = "literal" },
+ -- Uppercase constants of at least 3 characters in len
+ { pattern = "%u[%u_][%u%d_]+", type = "number" },
+ -- Magic constants
+ { pattern = "__[%u]+__", type = "number" },
+ -- Everything else
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["return"] = "keyword",
+ ["if"] = "keyword",
+ ["else"] = "keyword",
+ ["elseif"] = "keyword",
+ ["endif"] = "keyword",
+ ["declare"] = "keyword",
+ ["enddeclare"] = "keyword",
+ ["switch"] = "keyword",
+ ["endswitch"] = "keyword",
+ ["as"] = "keyword",
+ ["do"] = "keyword",
+ ["for"] = "keyword",
+ ["endfor"] = "keyword",
+ ["foreach"] = "keyword",
+ ["endforeach"] = "keyword",
+ ["while"] = "keyword",
+ ["endwhile"] = "keyword",
+ ["switch"] = "keyword",
+ ["match"] = "keyword",
+ ["case"] = "keyword",
+ ["continue"] = "keyword",
+ ["default"] = "keyword",
+ ["break"] = "keyword",
+ ["goto"] = "keyword",
+
+ ["try"] = "keyword",
+ ["catch"] = "keyword",
+ ["throw"] = "keyword",
+ ["finally"] = "keyword",
+
+ ["class"] = "keyword",
+ ["trait"] = "keyword",
+ ["interface"] = "keyword",
+ ["public"] = "keyword",
+ ["static"] = "keyword",
+ ["protected"] = "keyword",
+ ["private"] = "keyword",
+ ["abstract"] = "keyword",
+ ["final"] = "keyword",
+ ["$this"] = "literal",
+
+ ["function"] = "keyword",
+ ["fn"] = "keyword",
+ ["global"] = "keyword",
+ ["var"] = "keyword",
+ ["const"] = "keyword",
+
+ ["bool"] = "literal",
+ ["boolean"] = "literal",
+ ["int"] = "literal",
+ ["integer"] = "literal",
+ ["real"] = "literal",
+ ["double"] = "literal",
+ ["float"] = "literal",
+ ["string"] = "literal",
+ ["object"] = "literal",
+ ["callable"] = "literal",
+ ["iterable"] = "literal",
+ ["void"] = "literal",
+ ["parent"] = "literal",
+ ["self"] = "literal",
+ ["mixed"] = "literal",
+
+ ["namespace"] = "keyword",
+ ["extends"] = "keyword",
+ ["implements"] = "keyword",
+ ["instanceof"] = "keyword",
+ ["require"] = "keyword",
+ ["require_once"] = "keyword",
+ ["include"] = "keyword",
+ ["include_once"] = "keyword",
+ ["use"] = "keyword",
+ ["new"] = "keyword",
+ ["clone"] = "keyword",
+
+ ["true"] = "number",
+ ["false"] = "number",
+ ["NULL"] = "number",
+ ["null"] = "number",
+
+ ["print"] = "function",
+ ["echo"] = "function",
+ ["exit"] = "function",
+ },
+}
diff --git a/plugins/language_pico8.lua b/plugins/language_pico8.lua
index 8edf92f..c8ba027 100644
--- a/plugins/language_pico8.lua
+++ b/plugins/language_pico8.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_powershell.lua b/plugins/language_powershell.lua
index 01c00f4..6cd0968 100644
--- a/plugins/language_powershell.lua
+++ b/plugins/language_powershell.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_psql.lua b/plugins/language_psql.lua
index 7c6c4b7..389f32a 100644
--- a/plugins/language_psql.lua
+++ b/plugins/language_psql.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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
new file mode 100644
index 0000000..9661b1b
--- /dev/null
+++ b/plugins/language_ruby.lua
@@ -0,0 +1,74 @@
+-- mod-version:1 -- lite-xl 1.16
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.rb", "%.gemspec" },
+ headers = "^#!.*[ /]ruby",
+ comment = "#",
+ patterns = {
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?0x%x+", type = "number" },
+ { pattern = "%#.-\n", type = "comment" },
+ { pattern = "-?%d+[%d%.eE]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "@?@[%a_][%w_]*", type = "keyword2" },
+ { pattern = "::[%w_]*", type = "symbol" },
+ { pattern = ":[%w_]*", type = "keyword2" },
+ { pattern = "[%a_][%w_]*:[^:]", type = "keyword2" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["nil"] = "literal",
+ ["end"] = "literal",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["private"] = "keyword",
+ ["extend"] = "keyword",
+ ["include"] = "keyword",
+ ["require"] = "keyword",
+ ["require_dependency"] = "keyword",
+ ["__ENCODING__"] = "keyword",
+ ["__LINE__"] = "keyword",
+ ["__FILE__"] = "keyword",
+ ["BEGIN"] = "keyword",
+ ["END"] = "keyword",
+ ["alias"] = "keyword",
+ ["and"] = "keyword",
+ ["begin"] = "keyword",
+ ["break"] = "keyword",
+ ["case"] = "keyword",
+ ["class"] = "keyword",
+ ["def"] = "keyword",
+ ["defined?"] = "keyword",
+ ["do"] = "keyword",
+ ["else"] = "keyword",
+ ["elsif"] = "keyword",
+ ["end"] = "keyword",
+ ["ensure"] = "keyword",
+ ["for"] = "keyword",
+ ["if"] = "keyword",
+ ["in"] = "keyword",
+ ["module"] = "keyword",
+ ["next"] = "keyword",
+ ["not"] = "keyword",
+ ["or"] = "keyword",
+ ["redo"] = "keyword",
+ ["rescue"] = "keyword",
+ ["retry"] = "keyword",
+ ["return"] = "keyword",
+ ["self"] = "keyword",
+ ["super"] = "keyword",
+ ["then"] = "keyword",
+ ["true"] = "keyword",
+ ["undef"] = "keyword",
+ ["unless"] = "keyword",
+ ["until"] = "keyword",
+ ["when"] = "keyword",
+ ["while"] = "keyword",
+ ["yield"] = "keyword"
+ },
+}
+
diff --git a/plugins/language_rust.lua b/plugins/language_rust.lua
index 37ba81f..4d0fef1 100644
--- a/plugins/language_rust.lua
+++ b/plugins/language_rust.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_sass.lua b/plugins/language_sass.lua
new file mode 100644
index 0000000..ce4aa2b
--- /dev/null
+++ b/plugins/language_sass.lua
@@ -0,0 +1,46 @@
+-- mod-version:1 -- lite-xl 1.16
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.sass$" },
+ comment = "//",
+ patterns = {
+ { pattern = "/[/%*].-\n", type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "$%w+", type = "keyword" },
+ { pattern = "@%w+", type = "literal" },
+ { pattern = "[#,]%w+", type = "function" },
+ { pattern = "&", type = "keyword2" },
+ { pattern = "[:%/%*%-]", type = "operator" },
+ { pattern = "[%a][%w-]*%s*%f[:]", type = "keyword2" },
+ { pattern = "-?%d+[%d%.]*p[xt]", type = "number" },
+ { pattern = "-?%d+[%d%.]*deg", type = "number" },
+ { pattern = "-?%d+[%d%.]*[s%%]", type = "number" },
+ { pattern = "-?%d+[%d%.]*", type = "number" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["transparent"] = "literal",
+ ["none"] = "literal",
+ ["absolute"] = "literal",
+ ["relative"] = "literal",
+ ["solid"] = "literal",
+ ["flex"] = "literal",
+ ["flex-start"] = "literal",
+ ["flex-end"] = "literal",
+ ["row"] = "literal",
+ ["center"] = "literal",
+ ["column"] = "literal",
+ ["pointer"] = "literal",
+ ["ease"] = "literal",
+ ["white"] = "function",
+ ["black"] = "function",
+ ["gray"] = "function",
+ ["blue"] = "function",
+ ["red"] = "function",
+ ["purple"] = "function",
+ ["green"] = "function",
+ ["yellow"] = "function"
+ }
+}
diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua
index c4153c2..684b070 100644
--- a/plugins/language_sh.lua
+++ b/plugins/language_sh.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
@@ -13,7 +14,7 @@ syntax.add {
{ pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
{ pattern = "[!<>|&%[%]=*]", type = "operator" },
{ pattern = "%f[%S]%-[%w%-_]+", type = "function" },
- { pattern = "${.*}", type = "keyword2" },
+ { pattern = "${.-}", type = "keyword2" },
{ pattern = "$[%a_@*][%w_]*", type = "keyword2" },
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
diff --git a/plugins/language_teal.lua b/plugins/language_teal.lua
index 8ab4c33..5b46fd8 100644
--- a/plugins/language_teal.lua
+++ b/plugins/language_teal.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_tex.lua b/plugins/language_tex.lua
index eced489..3f9a5fa 100644
--- a/plugins/language_tex.lua
+++ b/plugins/language_tex.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_wren.lua b/plugins/language_wren.lua
index ccd53db..62ee24f 100644
--- a/plugins/language_wren.lua
+++ b/plugins/language_wren.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {
diff --git a/plugins/language_zig.lua b/plugins/language_zig.lua
new file mode 100644
index 0000000..2c098af
--- /dev/null
+++ b/plugins/language_zig.lua
@@ -0,0 +1,211 @@
+-- mod-version:1 -- lite-xl 1.16
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.zig$" },
+ comment = "//",
+ patterns = {
+ { pattern = "//.-\n", type = "comment" },
+ { pattern = "#!.-\n", type = "comment" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "-?[iuf][%d_]+", type = "keyword2" },
+ { pattern = "-?\\x[%x_]+", type = "number" },
+ { pattern = "-?\\u{[%x_]+}", type = "number" },
+ { pattern = "-?%d+[%d%.eE]*f?", type = "number" },
+ { pattern = "-?%.?%d+f?", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "@?[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["fn"] = "keyword",
+
+ ["asm"] = "keyword",
+ ["volatile"] = "keyword",
+
+ ["continue"] = "keyword",
+ ["break"] = "keyword",
+ ["switch"] = "keyword",
+ ["for"] = "keyword",
+ ["while"] = "keyword",
+
+ ["var"] = "keyword",
+ ["anytype"] = "keyword",
+ ["const"] = "keyword",
+ ["test"] = "keyword",
+ ["packed"] = "keyword",
+ ["extern"] = "keyword",
+ ["export"] = "keyword",
+ ["pub"] = "keyword",
+ ["defer"] = "keyword",
+ ["errdefer"] = "keyword",
+ ["align"] = "keyword",
+ ["usingnamespace"] = "keyword",
+
+ ["noasync"] = "keyword",
+ ["async"] = "keyword",
+ ["await"] = "keyword",
+ ["cancel"] = "keyword",
+ ["suspend"] = "keyword",
+ ["resume"] = "keyword",
+
+ ["threadlocal"] = "keyword",
+
+ ["linksection"] = "keyword",
+
+ ["callconv"] = "keyword",
+
+ ["try"] = "keyword",
+ ["catch"] = "keyword",
+ ["orelse"] = "keyword",
+ ["unreachable"] = "keyword",
+ ["noreturn"] = "keyword",
+ ["error"] = "keyword",
+ ["if"] = "keyword",
+ ["else"] = "keyword",
+ ["return"] = "keyword",
+ ["comptime"] = "keyword",
+
+ ["stdcallcc"] = "keyword",
+ ["ccc"] = "keyword",
+ ["nakedcc"] = "keyword",
+
+ ["and"] = "keyword",
+ ["or"] = "keyword",
+
+ -- std
+ ["@import"] = "keyword",
+ ["@cImport"] = "keyword",
+
+ [ "@addWithOverflow" ] = "function",
+ [ "@alignCast" ] = "function",
+ [ "@alignOf" ] = "function",
+ [ "@as" ] = "function",
+ [ "@asyncCall" ] = "function",
+ [ "@atomicLoad" ] = "function",
+ [ "@atomicRmw" ] = "function",
+ [ "@atomicStore" ] = "function",
+ [ "@bitCast" ] = "function",
+ [ "@bitOffsetOf" ] = "function",
+ [ "@boolToInt" ] = "function",
+ [ "@bitSizeOf" ] = "function",
+ [ "@breakpoint" ] = "function",
+ [ "@mulAdd" ] = "function",
+ [ "@byteSwap" ] = "function",
+ [ "@bitReverse" ] = "function",
+ [ "@byteOffsetOf" ] = "function",
+ [ "@call" ] = "function",
+ [ "@cDefine" ] = "function",
+ [ "@cImport" ] = "function",
+ [ "@cInclude" ] = "function",
+ [ "@clz" ] = "function",
+ [ "@cmpxchgStrong" ] = "function",
+ [ "@cmpxchgWeak" ] = "function",
+ [ "@compileError" ] = "function",
+ [ "@compileLog" ] = "function",
+ [ "@ctz" ] = "function",
+ [ "@cUndef" ] = "function",
+ [ "@divExact" ] = "function",
+ [ "@divFloor" ] = "function",
+ [ "@divTrunc" ] = "function",
+ [ "@embedFile" ] = "function",
+ [ "@enumToInt" ] = "function",
+ [ "@errorName" ] = "function",
+ [ "@errorReturnTrace" ] = "function",
+ [ "@errorToInt" ] = "function",
+ [ "@errSetCast" ] = "function",
+ [ "@export" ] = "function",
+ [ "@fence" ] = "function",
+ [ "@field" ] = "function",
+ [ "@fieldParentPtr" ] = "function",
+ [ "@floatCast" ] = "function",
+ [ "@floatToInt" ] = "function",
+ [ "@Frame" ] = "function",
+ [ "@frame" ] = "function",
+ [ "@frameAddress" ] = "function",
+ [ "@frameSize" ] = "function",
+ [ "@hasDecl" ] = "function",
+ [ "@hasField" ] = "function",
+ [ "@import" ] = "function",
+ [ "@intCast" ] = "function",
+ [ "@intToEnum" ] = "function",
+ [ "@intToError" ] = "function",
+ [ "@intToFloat" ] = "function",
+ [ "@intToPtr" ] = "function",
+ [ "@memcpy" ] = "function",
+ [ "@memset" ] = "function",
+ [ "@wasmMemorySize" ] = "function",
+ [ "@wasmMemoryGrow" ] = "function",
+ [ "@mod" ] = "function",
+ [ "@mulWithOverflow" ] = "function",
+ [ "@panic" ] = "function",
+ [ "@popCount" ] = "function",
+ [ "@ptrCast" ] = "function",
+ [ "@ptrToInt" ] = "function",
+ [ "@rem" ] = "function",
+ [ "@returnAddress" ] = "function",
+ [ "@setAlignStack" ] = "function",
+ [ "@setCold" ] = "function",
+ [ "@setEvalBranchQuota" ] = "function",
+ [ "@setFloatMode" ] = "function",
+ [ "@setRuntimeSafety" ] = "function",
+ [ "@shlExact" ] = "function",
+ [ "@shlWithOverflow" ] = "function",
+ [ "@shrExact" ] = "function",
+ [ "@shuffle" ] = "function",
+ [ "@sizeOf" ] = "function",
+ [ "@splat" ] = "function",
+ [ "@src" ] = "function",
+ [ "@sqrt" ] = "function",
+ [ "@sin" ] = "function",
+ [ "@cos" ] = "function",
+ [ "@exp" ] = "function",
+ [ "@exp2" ] = "function",
+ [ "@log" ] = "function",
+ [ "@log2" ] = "function",
+ [ "@log10" ] = "function",
+ [ "@fabs" ] = "function",
+ [ "@floor" ] = "function",
+ [ "@ceil" ] = "function",
+ [ "@trunc" ] = "function",
+ [ "@round" ] = "function",
+ [ "@subWithOverflow" ] = "function",
+ [ "@tagName" ] = "function",
+ [ "@TagType" ] = "function",
+ [ "@This" ] = "function",
+ [ "@truncate" ] = "function",
+ [ "@Type" ] = "function",
+ [ "@typeInfo" ] = "function",
+ [ "@typeName" ] = "function",
+ [ "@TypeOf" ] = "function",
+ [ "@unionInit" ] = "function",
+
+ -- types
+ ["void"] = "keyword2",
+ ["c_void"] = "keyword2",
+ ["isize"] = "keyword2",
+ ["usize"] = "keyword2",
+ ["c_short"] = "keyword2",
+ ["c_ushort"] = "keyword2",
+ ["c_int"] = "keyword2",
+ ["c_uint"] = "keyword2",
+ ["c_long"] = "keyword2",
+ ["c_ulong"] = "keyword2",
+ ["c_longlong"] = "keyword2",
+ ["c_ulonglong"] = "keyword2",
+ ["c_longdouble"] = "keyword2",
+ ["bool"] = "keyword2",
+
+ ["noreturn"] = "keyword2",
+ ["type"] = "keyword2",
+ ["anyerror"] = "keyword2",
+ ["comptime_int"] = "keyword2",
+ ["comptime_float"] = "keyword2",
+
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["null"] = "literal",
+ ["undefined"] = "literal",
+ },
+}
diff --git a/plugins/lastproject.lua b/plugins/lastproject.lua
deleted file mode 100644
index 5fb23bd..0000000
--- a/plugins/lastproject.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-local core = require "core"
-
-local last_project_filename = EXEDIR .. PATHSEP .. ".lite_last_project"
-
-
--- load last project path
-local fp = io.open(last_project_filename)
-local project_path
-if fp then
- project_path = fp:read("*a")
- fp:close()
-end
-
-
--- save current project path
-local fp = io.open(last_project_filename, "w")
-if nil ~= fp then
- fp:write(system.absolute_path ".")
- fp:close()
-end
-
-
--- restart using last project path if we had no commandline arguments and could
--- find a last-project file
-if #ARGS == 1 and project_path then
- system.exec(string.format("%s %q", EXEFILE, project_path))
- core.quit(true)
-end
-
diff --git a/plugins/lfautoinsert.lua b/plugins/lfautoinsert.lua
index 0ea7b9d..99f7e45 100644
--- a/plugins/lfautoinsert.lua
+++ b/plugins/lfautoinsert.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local config = require "core.config"
@@ -18,6 +19,7 @@ config.lfautoinsert_map = {
["%f[%w]repeat%s*\n"] = "until",
["%f[%w]function.*%)%s*\n"] = "end",
["^%s*<([^/][^%s>]*)[^>]*>%s*\n"] = "</$TEXT>",
+ ["/%*%s*\n"] = "*/",
}
diff --git a/plugins/linecopypaste.lua b/plugins/linecopypaste.lua
index eb6f375..a4a5e60 100755
--- a/plugins/linecopypaste.lua
+++ b/plugins/linecopypaste.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
diff --git a/plugins/lineguide.lua b/plugins/lineguide.lua
index fc24567..2cf0b42 100644
--- a/plugins/lineguide.lua
+++ b/plugins/lineguide.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local config = require "core.config"
local style = require "core.style"
local DocView = require "core.docview"
@@ -7,7 +8,9 @@ local draw = DocView.draw
function DocView:draw(...)
draw(self, ...)
- local offset = self:get_font():get_width("n") * config.line_limit
+ 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)
diff --git a/plugins/macmodkeys.lua b/plugins/macmodkeys.lua
index 69028ab..14f8995 100644
--- a/plugins/macmodkeys.lua
+++ b/plugins/macmodkeys.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local keymap = require "core.keymap"
local on_key_pressed = keymap.on_key_pressed
diff --git a/plugins/markers.lua b/plugins/markers.lua
index 6e397d7..f4a70d6 100644
--- a/plugins/markers.lua
+++ b/plugins/markers.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
-- Markers plugin for lite text editor
-- original implementation by Petri Häkkinen
diff --git a/plugins/memoryusage.lua b/plugins/memoryusage.lua
new file mode 100644
index 0000000..ee472dd
--- /dev/null
+++ b/plugins/memoryusage.lua
@@ -0,0 +1,19 @@
+-- mod-version:1 -- lite-xl 1.16
+-- original implementation by AqilCont
+local style = require "core.style"
+local StatusView = require "core.statusview"
+
+local get_items = StatusView.get_items
+
+function StatusView:get_items()
+ local left, right = get_items(self)
+ local t = {
+ style.text, (math.floor(collectgarbage("count") / 10.24) / 100) .. " MB",
+ style.dim, self.separator2,
+ }
+ for i, item in ipairs(t) do
+ table.insert(right, i, item)
+ end
+ return left, right
+end
+
diff --git a/plugins/motiontrail.lua b/plugins/motiontrail.lua
index e688e1b..6f448bb 100644
--- a/plugins/motiontrail.lua
+++ b/plugins/motiontrail.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local config = require "core.config"
local style = require "core.style"
diff --git a/plugins/openfilelocation.lua b/plugins/openfilelocation.lua
index 58c3d6f..48877bd 100644
--- a/plugins/openfilelocation.lua
+++ b/plugins/openfilelocation.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local config = require "core.config"
diff --git a/plugins/openselected.lua b/plugins/openselected.lua
index 65fdeb8..ccaa8e3 100644
--- a/plugins/openselected.lua
+++ b/plugins/openselected.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
diff --git a/plugins/projectmanager.lua b/plugins/projectmanager.lua
deleted file mode 100644
index b5a66e3..0000000
--- a/plugins/projectmanager.lua
+++ /dev/null
@@ -1,128 +0,0 @@
-local project_manager = {}
-
-local core = require "core"
-local command = require "core.command"
-local common = require "core.common"
-local keymap = require "core.keymap"
-
-local projects_file = ".lite_projects.lua"
-
-project_manager.projects = {}
-
-local function load_projects()
- local ok, t = pcall(dofile, EXEDIR .. "/" .. projects_file)
- if ok then project_manager.projects = t end
-end
-
-load_projects()
-
-local function serialize(val)
- if type(val) == "string" then
- return string.format("%q", val)
- elseif type(val) == "table" then
- local t = {}
- for k, v in pairs(val) do
- table.insert(t, "[" .. serialize(k) .. "]=" .. serialize(v))
- end
- return "{" .. table.concat(t, ",") .. "}"
- end
- return tostring(val)
-end
-
-local function save_projects()
- local fp = io.open(EXEDIR .. "/" .. projects_file, "w")
- if fp then
- fp:write("return ", serialize(project_manager.projects), "\n")
- fp:close()
- end
-end
-
-local function path_base_name(str)
- local pattern = "[\\/]?([^\\/]+)[\\/]?$"
- return str:match(pattern)
-end
-
-function project_manager.add_project()
- local proj_dir = system.absolute_path(".")
- local proj_name = path_base_name(proj_dir)
- core.command_view:set_text(proj_name)
- core.command_view:enter("Project Name",
- function(text)
- if text then
- project_manager.projects[text] = proj_dir
- save_projects()
- end
- end)
-end
-
-local function get_project_names()
- local t = {}
- for k, v in pairs(project_manager.projects) do table.insert(t, k) end
- return t
-end
-
-local function project_lister(func)
- local projects = get_project_names();
- core.command_view:enter("Open Project", func, function(text)
- local res = common.fuzzy_match(projects, text)
- for i, name in ipairs(res) do
- res[i] = {
- text = name,
- info = project_manager.projects[name],
- }
- end
- return res
- end)
-end
-
-function project_manager.rename_project(func)
- project_lister(function(text, item)
- if item then
- core.command_view:set_text(item.text)
- core.command_view:enter("Rename ".. item.text,
- function(_text)
- if _text then
- project_manager.projects[_text] = project_manager.projects[item.text]
- project_manager.projects[item.text] = nil
- save_projects()
- end
- end)
- end
- end)
-end
-
-function project_manager.open_project()
- project_lister(function(text, item)
- if item then
- system.exec(string.format("%q %q", EXEFILE, item.info))
- end
- end)
-end
-
-function project_manager.switch_project()
- project_lister(function(text, item)
- if item then
- system.exec(string.format("%q %q", EXEFILE, item.info))
- os.exit()
- end
- end)
-end
-
-function project_manager.remove_project()
- project_lister(function(text, item)
- if item then
- project_manager.projects[item.text] = nil
- save_projects()
- end
- end)
-end
-
-command.add(nil, {
- ["project-manager:open-project"] = project_manager.open_project,
- ["project-manager:switch-project"] = project_manager.switch_project,
- ["project-manager:add-project"] = project_manager.add_project,
- ["project-manager:remove-project"] = project_manager.remove_project,
- ["project-manager:rename-project"] = project_manager.rename_project,
- })
-
-return project_manager
diff --git a/plugins/rainbowparen.lua b/plugins/rainbowparen.lua
index b2689f0..b6075ac 100644
--- a/plugins/rainbowparen.lua
+++ b/plugins/rainbowparen.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local tokenizer = require "core.tokenizer"
local style = require "core.style"
local common = require "core.common"
diff --git a/plugins/restoretabs.lua b/plugins/restoretabs.lua
new file mode 100644
index 0000000..6776e2c
--- /dev/null
+++ b/plugins/restoretabs.lua
@@ -0,0 +1,55 @@
+-- mod-version:1 -- lite-xl 1.16
+-- 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"
+local RootView = require "core.rootview"
+local command = require "core.command"
+local keymap = require "core.keymap"
+
+local update = RootView.update
+local initialized_tab_system = false
+
+local tab_history = { }
+local history_size = 10
+
+RootView.update = function(self)
+ update(self)
+ if not initialized_tab_system then
+ local Node = getmetatable(self.root_node)
+ local old_close = Node.close_view
+
+ Node.close_view = function(self, root, view)
+ if view.doc and view.doc.abs_filename then
+ local closing_filename = view.doc.abs_filename
+ for i,filename in ipairs(tab_history) do
+ if filename == closing_filename then
+ table.remove(tab_history, i)
+ break
+ end
+ end
+ table.insert(tab_history, closing_filename)
+ if #tab_history > history_size then
+ table.remove(tab_history, 1)
+ end
+ end
+ old_close(self, root, view)
+ end
+
+ initialized_tab_system = true
+ end
+end
+
+
+command.add("core.docview", {
+ ["restore-tabs:restore-tab"] = function()
+ if #tab_history > 0 then
+ local file = tab_history[#tab_history]
+ core.root_view:open_doc(core.open_doc(file))
+ table.remove(tab_history)
+ end
+ end
+})
+
+keymap.add {
+ ["ctrl+shift+t"] = "restore-tabs:restore-tab"
+}
diff --git a/plugins/scale.lua b/plugins/scale.lua
index 5dfa699..78dc9e2 100644
--- a/plugins/scale.lua
+++ b/plugins/scale.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local common = require "core.common"
local command = require "core.command"
@@ -10,13 +11,15 @@ 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" })
-- the following should be kept in sync with core.style's default font settings
-font_cache[style.font] = { EXEDIR .. "/data/fonts/font.ttf", 14 * SCALE }
-font_cache[style.big_font] = { EXEDIR .. "/data/fonts/font.ttf", 34 * SCALE }
-font_cache[style.icon_font] = { EXEDIR .. "/data/fonts/icons.ttf", 14 * SCALE }
-font_cache[style.code_font] = { EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * SCALE }
+font_cache[style.font] = { DATADIR .. "/fonts/font.ttf", 14 * SCALE }
+font_cache[style.big_font] = { DATADIR .. "/fonts/font.ttf", 34 * SCALE }
+font_cache[style.icon_font] = { DATADIR .. "/fonts/icons.ttf", 14 * SCALE }
+font_cache[style.code_font] = { DATADIR .. "/fonts/monospace.ttf", 13.5 * SCALE }
local load_font = renderer.font.load
@@ -93,11 +96,26 @@ function RootView:on_mouse_wheel(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() set_scale(default) end,
- ["scale:decrease"] = function() set_scale(current_scale * 0.9) end,
- ["scale:increase"] = function() set_scale(current_scale * 1.1) end,
+ ["scale:reset" ] = function() res_scale() end,
+ ["scale:decrease"] = function() dec_scale() end,
+ ["scale:increase"] = function() inc_scale() end,
})
keymap.add {
diff --git a/plugins/scalestatus.lua b/plugins/scalestatus.lua
index 03216b5..2981523 100644
--- a/plugins/scalestatus.lua
+++ b/plugins/scalestatus.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
--[[
scalestatus.lua
displays current scale (zoom) in status view
diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua
index 93dfe17..fd10239 100644
--- a/plugins/selectionhighlight.lua
+++ b/plugins/selectionhighlight.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local style = require "core.style"
local DocView = require "core.docview"
diff --git a/plugins/sort.lua b/plugins/sort.lua
index 2e865ab..34b2b93 100644
--- a/plugins/sort.lua
+++ b/plugins/sort.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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 1f29792..975ef91 100644
--- a/plugins/spellcheck.lua
+++ b/plugins/spellcheck.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local style = require "core.style"
local config = require "core.config"
diff --git a/plugins/tabnumbers.lua b/plugins/tabnumbers.lua
index deabbcd..70da707 100644
--- a/plugins/tabnumbers.lua
+++ b/plugins/tabnumbers.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local common = require "core.common"
local core = require "core"
local style = require "core.style"
diff --git a/plugins/themeselect.lua b/plugins/themeselect.lua
new file mode 100644
index 0000000..cafc1be
--- /dev/null
+++ b/plugins/themeselect.lua
@@ -0,0 +1,48 @@
+-- mod-version:1 -- lite-xl 1.16
+local core = require "core"
+
+-- Load a specific theme when the filename of an active document does match
+-- a pattern.
+
+-- usage:
+-- require("plugins.themeselect").add_pattern("%.md$", "summer")
+
+local theme_select = { }
+
+local saved_colors_module = "core.style"
+
+local themes_patterns = {
+}
+
+local reload_module = core.reload_module
+local set_visited = core.set_visited
+
+function core.reload_module(name)
+ if name:match("^colors%.") then
+ saved_colors_module = name
+ end
+ reload_module(name)
+end
+
+function core.set_visited(filename)
+ set_visited(filename)
+ for _, select in ipairs(themes_patterns) do
+ if filename:match(select.pattern) then
+ reload_module("colors." .. select.theme)
+ return
+ end
+ end
+ if saved_colors_module then
+ reload_module(saved_colors_module)
+ end
+end
+
+function theme_select.add_pattern(pattern, theme)
+ table.insert(themes_patterns, {pattern = pattern, theme = theme})
+end
+
+function theme_select.clear_patterns()
+ themes_patterns = {}
+end
+
+return theme_select
diff --git a/plugins/titleize.lua b/plugins/titleize.lua
index 2e4b52a..ac64f44 100644
--- a/plugins/titleize.lua
+++ b/plugins/titleize.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
diff --git a/plugins/togglesnakecamel.lua b/plugins/togglesnakecamel.lua
index 236c22e..0ba3ce9 100644
--- a/plugins/togglesnakecamel.lua
+++ b/plugins/togglesnakecamel.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
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 c4cc7bb..18d26a2 100644
--- a/plugins/unboundedscroll.lua
+++ b/plugins/unboundedscroll.lua
@@ -1,3 +1,4 @@
+-- mod-version:1 -- lite-xl 1.16
local DocView = require "core.docview"
function DocView.clamp_scroll_position()
diff --git a/plugins/workspace.lua b/plugins/workspace.lua
deleted file mode 100644
index 028e0a2..0000000
--- a/plugins/workspace.lua
+++ /dev/null
@@ -1,164 +0,0 @@
-local core = require "core"
-local DocView = require "core.docview"
-
-local workspace_filename = ".lite_workspace.lua"
-
-
-local function serialize(val)
- if type(val) == "string" then
- return string.format("%q", val)
- elseif type(val) == "table" then
- local t = {}
- for k, v in pairs(val) do
- table.insert(t, "[" .. serialize(k) .. "]=" .. serialize(v))
- end
- return "{" .. table.concat(t, ",") .. "}"
- end
- return tostring(val)
-end
-
-
-local function has_no_locked_children(node)
- if node.locked then return false end
- if node.type == "leaf" then return true end
- return has_no_locked_children(node.a) and has_no_locked_children(node.b)
-end
-
-
-local function get_unlocked_root(node)
- if node.type == "leaf" then
- return not node.locked and node
- end
- if has_no_locked_children(node) then
- return node
- end
- return get_unlocked_root(node.a) or get_unlocked_root(node.b)
-end
-
-
-local function save_view(view)
- local mt = getmetatable(view)
- if mt == DocView then
- return {
- type = "doc",
- active = (core.active_view == view),
- filename = view.doc.filename,
- selection = { view.doc:get_selection() },
- scroll = { x = view.scroll.to.x, y = view.scroll.to.y },
- text = not view.doc.filename and view.doc:get_text(1, 1, math.huge, math.huge)
- }
- end
- for name, mod in pairs(package.loaded) do
- if mod == mt then
- return {
- type = "view",
- active = (core.active_view == view),
- module = name
- }
- end
- end
-end
-
-
-local function load_view(t)
- if t.type == "doc" then
- local ok, doc = pcall(core.open_doc, t.filename)
- if not ok then
- return DocView(core.open_doc())
- end
- local dv = DocView(doc)
- if t.text then doc:insert(1, 1, t.text) end
- doc:set_selection(table.unpack(t.selection))
- dv.last_line, dv.last_col = doc:get_selection()
- dv.scroll.x, dv.scroll.to.x = t.scroll.x, t.scroll.x
- dv.scroll.y, dv.scroll.to.y = t.scroll.y, t.scroll.y
- return dv
- end
- return require(t.module)()
-end
-
-
-local function save_node(node)
- local res = {}
- res.type = node.type
- if node.type == "leaf" then
- res.views = {}
- for _, view in ipairs(node.views) do
- local t = save_view(view)
- if t then
- table.insert(res.views, t)
- if node.active_view == view then
- res.active_view = #res.views
- end
- end
- end
- else
- res.divider = node.divider
- res.a = save_node(node.a)
- res.b = save_node(node.b)
- end
- return res
-end
-
-
-local function load_node(node, t)
- if t.type == "leaf" then
- local res
- for _, v in ipairs(t.views) do
- local view = load_view(v)
- if v.active then res = view end
- node:add_view(view)
- end
- if t.active_view then
- node:set_active_view(node.views[t.active_view])
- end
- return res
- else
- node:split(t.type == "hsplit" and "right" or "down")
- node.divider = t.divider
- local res1 = load_node(node.a, t.a)
- local res2 = load_node(node.b, t.b)
- return res1 or res2
- end
-end
-
-
-local function save_workspace()
- local root = get_unlocked_root(core.root_view.root_node)
- local fp = io.open(workspace_filename, "w")
- if fp then
- fp:write("return ", serialize(save_node(root)), "\n")
- fp:close()
- end
-end
-
-
-local function load_workspace()
- local ok, t = pcall(dofile, workspace_filename)
- os.remove(workspace_filename)
- if ok then
- local root = get_unlocked_root(core.root_view.root_node)
- local active_view = load_node(root, t)
- if active_view then
- core.set_active_view(active_view)
- end
- end
-end
-
-
-local run = core.run
-
-function core.run(...)
- if #core.docs == 0 then
- core.try(load_workspace)
-
- local exit = os.exit
- function os.exit(...)
- save_workspace()
- exit(...)
- end
- end
-
- core.run = run
- return core.run(...)
-end