git subrepo clone https://github.com/rxi/lite-plugins vendor/lite-plugins
subrepo: subdir: "vendor/lite-plugins" merged: "de4227d" upstream: origin: "https://github.com/rxi/lite-plugins" branch: "master" commit: "de4227d" git-subrepo: version: "0.4.2" origin: "https://github.com/ingydotnet/git-subrepo" commit: "65fde50"
This commit is contained in:
parent
c843deea3d
commit
cb5132f393
12
vendor/lite-plugins/.gitrepo
vendored
Normal file
12
vendor/lite-plugins/.gitrepo
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
; DO NOT EDIT (unless you know what you are doing)
|
||||||
|
;
|
||||||
|
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||||
|
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
||||||
|
;
|
||||||
|
[subrepo]
|
||||||
|
remote = https://github.com/rxi/lite-plugins
|
||||||
|
branch = master
|
||||||
|
commit = de4227d55a5c821e3450554c952dfb3b1b192266
|
||||||
|
parent = c843deea3de5d5d8782fe4dadbdbd40422ab88f8
|
||||||
|
method = merge
|
||||||
|
cmdver = 0.4.2
|
86
vendor/lite-plugins/README.md
vendored
Normal file
86
vendor/lite-plugins/README.md
vendored
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
Plugins for the [lite text editor](https://github.com/rxi/lite)
|
||||||
|
|
||||||
|
*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.*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Plugin | Description
|
||||||
|
-------|-----------------------------------------
|
||||||
|
[`autoinsert`](plugins/autoinsert.lua?raw=1) | Automatically inserts closing brackets and quotes
|
||||||
|
[`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))*
|
||||||
|
[`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))*
|
||||||
|
[`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))*
|
||||||
|
[`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
|
||||||
|
[`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.
|
||||||
|
[`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
|
||||||
|
[`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))*
|
||||||
|
[`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
|
||||||
|
[`language_cpp`](plugins/language_cpp.lua?raw=1) | Syntax for the [C++](https://isocpp.org/) programming language
|
||||||
|
[`language_csharp`](plugins/language_csharp.lua?raw=1) | Syntax for the [C#](http://csharp.net) programming language
|
||||||
|
[`language_d`](plugins/language_d.lua?raw=1) | Syntax for the [D](https://dlang.org/) programming language
|
||||||
|
[`language_elixir`](plugins/language_elixir.lua?raw=1) | Syntax for the [Elixir](https://elixir-lang.org) programming language
|
||||||
|
[`language_elm`](plugins/language_elm.lua?raw=1) | Syntax for the [Elm](https://elm-lang.org) programming language
|
||||||
|
[`language_fe`](plugins/language_fe.lua?raw=1) | Syntax for the [fe](https://github.com/rxi/fe) programming language
|
||||||
|
[`language_fennel`](plugins/language_fennel.lua?raw=1) | Syntax for the [fennel](https://fennel-lang.org) programming language
|
||||||
|
[`language_gdscript`](plugins/language_gdscript.lua?raw=1) | Syntax for the [Godot Engine](https://godotengine.org/)'s GDScript scripting language
|
||||||
|
[`language_glsl`](plugins/language_glsl.lua?raw=1) | Syntax for the [GLSL](https://www.khronos.org/registry/OpenGL/specs/gl/) programming language
|
||||||
|
[`language_go`](plugins/language_go.lua?raw=1) | Syntax for the [Go](https://golang.org/) programming language
|
||||||
|
[`language_hlsl`](plugins/language_hlsl.lua?raw=1) | Syntax for the [HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl) programming language
|
||||||
|
[`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_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1) | Syntax for [Kaitai](http://kaitai.io/) struct files
|
||||||
|
[`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_odin`](plugins/language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) 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_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language
|
||||||
|
[`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
|
||||||
|
[`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))*
|
||||||
|
[`linter`](https://github.com/drmargarido/linters)* | Linters for multiple languages
|
||||||
|
[`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))*
|
||||||
|
[`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))*
|
||||||
|
[`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
|
||||||
|
[`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
|
||||||
|
[`spellcheck`](plugins/spellcheck.lua?raw=1) | Underlines misspelt words *([screenshot](https://user-images.githubusercontent.com/3920290/79923973-9caa7400-842e-11ea-85d4-7a196a91ca50.png))* *— note: on Windows a [`words.txt`](https://github.com/dwyl/english-words/blob/master/words.txt) dictionary file must be placed beside the exe*
|
||||||
|
[`theme16`](https://github.com/monolifed/theme16)* | Theme manager with base16 themes
|
||||||
|
[`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
|
114
vendor/lite-plugins/plugins/autoinsert.lua
vendored
Normal file
114
vendor/lite-plugins/plugins/autoinsert.lua
vendored
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
local core = require "core"
|
||||||
|
local translate = require "core.doc.translate"
|
||||||
|
local config = require "core.config"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
|
||||||
|
config.autoinsert_map = {
|
||||||
|
["["] = "]",
|
||||||
|
["{"] = "}",
|
||||||
|
["("] = ")",
|
||||||
|
['"'] = '"',
|
||||||
|
["'"] = "'",
|
||||||
|
["`"] = "`",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local function is_closer(chr)
|
||||||
|
for _, v in pairs(config.autoinsert_map) do
|
||||||
|
if v == chr then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function count_char(text, chr)
|
||||||
|
local count = 0
|
||||||
|
for _ in text:gmatch(chr) do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local on_text_input = DocView.on_text_input
|
||||||
|
|
||||||
|
function DocView:on_text_input(text)
|
||||||
|
local mapping = config.autoinsert_map[text]
|
||||||
|
|
||||||
|
-- prevents plugin from operating on `CommandView`
|
||||||
|
if getmetatable(self) ~= DocView then
|
||||||
|
return on_text_input(self, text)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- wrap selection if we have a selection
|
||||||
|
if mapping and self.doc:has_selection() then
|
||||||
|
local l1, c1, l2, c2, swap = self.doc:get_selection(true)
|
||||||
|
self.doc:insert(l2, c2, mapping)
|
||||||
|
self.doc:insert(l1, c1, text)
|
||||||
|
self.doc:set_selection(l1, c1, l2, c2 + 2, swap)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- skip inserting closing text
|
||||||
|
local chr = self.doc:get_char(self.doc:get_selection())
|
||||||
|
if text == chr and is_closer(chr) then
|
||||||
|
self.doc:move_to(1)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- don't insert closing quote if we have a non-even number on this line
|
||||||
|
local line = self.doc:get_selection()
|
||||||
|
if text == mapping and count_char(self.doc.lines[line], text) % 2 == 1 then
|
||||||
|
return on_text_input(self, text)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- auto insert closing bracket
|
||||||
|
if mapping and (chr:find("%s") or is_closer(chr) and chr ~= '"') then
|
||||||
|
on_text_input(self, text)
|
||||||
|
on_text_input(self, mapping)
|
||||||
|
self.doc:move_to(-1)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
on_text_input(self, text)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function predicate()
|
||||||
|
return getmetatable(core.active_view) == DocView
|
||||||
|
and not core.active_view.doc:has_selection()
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add(predicate, {
|
||||||
|
["autoinsert:backspace"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local l, c = doc:get_selection()
|
||||||
|
local chr = doc:get_char(l, c)
|
||||||
|
if config.autoinsert_map[doc:get_char(l, c - 1)] and is_closer(chr) then
|
||||||
|
doc:delete_to(1)
|
||||||
|
end
|
||||||
|
command.perform "doc:backspace"
|
||||||
|
end,
|
||||||
|
|
||||||
|
["autoinsert:delete-to-previous-word-start"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local le, ce = translate.previous_word_start(doc, doc:get_selection())
|
||||||
|
while true do
|
||||||
|
local l, c = doc:get_selection()
|
||||||
|
if l == le and c == ce then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
command.perform "autoinsert:backspace"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["backspace"] = "autoinsert:backspace",
|
||||||
|
["ctrl+backspace"] = "autoinsert:delete-to-previous-word-start",
|
||||||
|
["ctrl+shift+backspace"] = "autoinsert:delete-to-previous-word-start",
|
||||||
|
}
|
35
vendor/lite-plugins/plugins/autowrap.lua
vendored
Normal file
35
vendor/lite-plugins/plugins/autowrap.lua
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
require "plugins.reflow"
|
||||||
|
local config = require "core.config"
|
||||||
|
local command = require "core.command"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
config.autowrap_files = { "%.md$", "%.txt$" }
|
||||||
|
|
||||||
|
|
||||||
|
local on_text_input = DocView.on_text_input
|
||||||
|
|
||||||
|
DocView.on_text_input = function(self, ...)
|
||||||
|
on_text_input(self, ...)
|
||||||
|
|
||||||
|
-- early-exit if the filename does not match a file type pattern
|
||||||
|
local filename = self.doc.filename or ""
|
||||||
|
local matched = false
|
||||||
|
for _, ptn in ipairs(config.autowrap_files) do
|
||||||
|
if filename:match(ptn) then
|
||||||
|
matched = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not matched then return end
|
||||||
|
|
||||||
|
-- do automatic reflow on line if we're typing at the end of the line and have
|
||||||
|
-- reached the line limit
|
||||||
|
local line, col = self.doc:get_selection()
|
||||||
|
local text = self.doc:get_text(line, 1, line, math.huge)
|
||||||
|
if #text >= config.line_limit and col > #text then
|
||||||
|
command.perform("doc:select-lines")
|
||||||
|
command.perform("reflow:reflow")
|
||||||
|
command.perform("doc:move-to-next-char")
|
||||||
|
command.perform("doc:move-to-previous-char")
|
||||||
|
end
|
||||||
|
end
|
72
vendor/lite-plugins/plugins/bigclock.lua
vendored
Normal file
72
vendor/lite-plugins/plugins/bigclock.lua
vendored
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
local core = require "core"
|
||||||
|
local style = require "core.style"
|
||||||
|
local command = require "core.command"
|
||||||
|
local common = require "core.common"
|
||||||
|
local config = require "core.config"
|
||||||
|
local View = require "core.view"
|
||||||
|
|
||||||
|
|
||||||
|
config.bigclock_time_format = "%H:%M:%S"
|
||||||
|
config.bigclock_date_format = "%A, %d %B %Y"
|
||||||
|
config.bigclock_scale = 1
|
||||||
|
|
||||||
|
|
||||||
|
local ClockView = View:extend()
|
||||||
|
|
||||||
|
|
||||||
|
function ClockView:new()
|
||||||
|
ClockView.super.new(self)
|
||||||
|
self.time_text = ""
|
||||||
|
self.date_text = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function ClockView:get_name()
|
||||||
|
return "Big Clock"
|
||||||
|
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.font_size = size
|
||||||
|
collectgarbage()
|
||||||
|
end
|
||||||
|
return self.font
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function ClockView:update()
|
||||||
|
local time_text = os.date(config.bigclock_time_format)
|
||||||
|
local date_text = os.date(config.bigclock_date_format)
|
||||||
|
if self.time_text ~= time_text or self.date_text ~= date_text then
|
||||||
|
core.redraw = true
|
||||||
|
self.time_text = time_text
|
||||||
|
self.date_text = date_text
|
||||||
|
end
|
||||||
|
ClockView.super.update(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function ClockView:draw()
|
||||||
|
self:update_fonts()
|
||||||
|
self:draw_background(style.background)
|
||||||
|
local x, y = self.position.x, self.position.y
|
||||||
|
local w, h = self.size.x, self.size.y
|
||||||
|
local _, y = common.draw_text(self.time_font, style.text, self.time_text, "center", x, y, w, h)
|
||||||
|
local th = self.date_font:get_height()
|
||||||
|
common.draw_text(self.date_font, style.dim, self.date_text, "center", x, y, w, th)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add(nil, {
|
||||||
|
["big-clock:open"] = function()
|
||||||
|
local node = core.root_view:get_active_node()
|
||||||
|
node:add_view(ClockView())
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
return ClockView
|
117
vendor/lite-plugins/plugins/bracketmatch.lua
vendored
Normal file
117
vendor/lite-plugins/plugins/bracketmatch.lua
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
local core = require "core"
|
||||||
|
local style = require "core.style"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
local bracket_maps = {
|
||||||
|
-- [ ] ( ) { }
|
||||||
|
{ [91] = 93, [40] = 41, [123] = 125, step = 1 },
|
||||||
|
-- ] [ ) ( } {
|
||||||
|
{ [93] = 91, [41] = 40, [125] = 123, step = -1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local function get_matching_bracket(doc, line, col, line_limit, open_byte, close_byte, step)
|
||||||
|
local end_line = line + line_limit * step
|
||||||
|
local depth = 0
|
||||||
|
|
||||||
|
while line ~= end_line do
|
||||||
|
local byte = doc.lines[line]:byte(col)
|
||||||
|
if byte == open_byte then
|
||||||
|
depth = depth + 1
|
||||||
|
elseif byte == close_byte then
|
||||||
|
depth = depth - 1
|
||||||
|
if depth == 0 then return line, col end
|
||||||
|
end
|
||||||
|
|
||||||
|
local prev_line, prev_col = line, col
|
||||||
|
line, col = doc:position_offset(line, col, step)
|
||||||
|
if line == prev_line and col == prev_col then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local state = {}
|
||||||
|
|
||||||
|
local function update_state(line_limit)
|
||||||
|
line_limit = line_limit or math.huge
|
||||||
|
|
||||||
|
-- reset if we don't have a document (eg. DocView isn't focused)
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
if not doc then
|
||||||
|
state = {}
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- early exit if nothing has changed since the last call
|
||||||
|
local line, col = doc:get_selection()
|
||||||
|
local change_id = doc:get_change_id()
|
||||||
|
if state.doc == doc and state.line == line and state.col == col
|
||||||
|
and state.change_id == change_id and state.limit == line_limit then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- find matching bracket if we're on a bracket
|
||||||
|
local line2, col2
|
||||||
|
for _, map in ipairs(bracket_maps) do
|
||||||
|
for i = 0, -1, -1 do
|
||||||
|
local line, col = doc:position_offset(line, col, i)
|
||||||
|
local open = doc.lines[line]:byte(col)
|
||||||
|
local close = map[open]
|
||||||
|
if close then
|
||||||
|
line2, col2 = get_matching_bracket(doc, line, col, line_limit, open, close, map.step)
|
||||||
|
goto found
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
::found::
|
||||||
|
|
||||||
|
-- update
|
||||||
|
state = {
|
||||||
|
change_id = change_id,
|
||||||
|
doc = doc,
|
||||||
|
line = line,
|
||||||
|
col = col,
|
||||||
|
line2 = line2,
|
||||||
|
col2 = col2,
|
||||||
|
limit = line_limit,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local update = DocView.update
|
||||||
|
|
||||||
|
function DocView:update(...)
|
||||||
|
update(self, ...)
|
||||||
|
update_state(100)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local draw_line_text = DocView.draw_line_text
|
||||||
|
|
||||||
|
function DocView:draw_line_text(idx, x, y)
|
||||||
|
draw_line_text(self, idx, x, y)
|
||||||
|
|
||||||
|
if self.doc == state.doc and idx == state.line2 then
|
||||||
|
local color = style.bracketmatch_color or style.syntax["function"]
|
||||||
|
local x1 = x + self:get_col_x_offset(idx, state.col2)
|
||||||
|
local x2 = x + self:get_col_x_offset(idx, state.col2 + 1)
|
||||||
|
local h = math.ceil(1 * SCALE)
|
||||||
|
renderer.draw_rect(x1, y + self:get_line_height() - h, x2 - x1, h, color)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["bracket-match:move-to-matching"] = function()
|
||||||
|
update_state()
|
||||||
|
if state.line2 then
|
||||||
|
core.active_view.doc:set_selection(state.line2, state.col2)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add { ["ctrl+m"] = "bracket-match:move-to-matching" }
|
19
vendor/lite-plugins/plugins/centerdoc.lua
vendored
Normal file
19
vendor/lite-plugins/plugins/centerdoc.lua
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
local config = require "core.config"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
|
||||||
|
local draw_line_gutter = DocView.draw_line_gutter
|
||||||
|
local get_gutter_width = DocView.get_gutter_width
|
||||||
|
|
||||||
|
|
||||||
|
function DocView:draw_line_gutter(idx, x, y)
|
||||||
|
local offset = self:get_gutter_width() - get_gutter_width(self)
|
||||||
|
draw_line_gutter(self, idx, x + offset, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function DocView:get_gutter_width()
|
||||||
|
local real_gutter_width = get_gutter_width(self)
|
||||||
|
local width = real_gutter_width + self:get_font():get_width("n") * config.line_limit
|
||||||
|
return math.max((self.size.x - width) / 2, real_gutter_width)
|
||||||
|
end
|
53
vendor/lite-plugins/plugins/colorpreview.lua
vendored
Normal file
53
vendor/lite-plugins/plugins/colorpreview.lua
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
local common = require "core.common"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
|
||||||
|
local white = { common.color "#ffffff" }
|
||||||
|
local black = { common.color "#000000" }
|
||||||
|
local tmp = {}
|
||||||
|
|
||||||
|
|
||||||
|
local function draw_color_previews(self, idx, x, y, ptn, base, nibbles)
|
||||||
|
local text = self.doc.lines[idx]
|
||||||
|
local s, e = 0, 0
|
||||||
|
|
||||||
|
while true do
|
||||||
|
s, e = text:find(ptn, e + 1)
|
||||||
|
if not s then break end
|
||||||
|
|
||||||
|
local str = text:sub(s, e)
|
||||||
|
local r, g, b = str:match(ptn)
|
||||||
|
r, g, b = tonumber(r, base), tonumber(g, base), tonumber(b, base)
|
||||||
|
|
||||||
|
-- #123 becomes #112233
|
||||||
|
if nibbles then
|
||||||
|
r = r * 16
|
||||||
|
g = g * 16
|
||||||
|
b = b * 16
|
||||||
|
end
|
||||||
|
|
||||||
|
local x1 = x + self:get_col_x_offset(idx, s)
|
||||||
|
local x2 = x + self:get_col_x_offset(idx, e + 1)
|
||||||
|
local oy = self:get_line_text_y_offset()
|
||||||
|
|
||||||
|
local text_color = math.max(r, g, b) < 128 and white or black
|
||||||
|
tmp[1], tmp[2], tmp[3] = r, g, b
|
||||||
|
|
||||||
|
local l1, _, l2, _ = self.doc:get_selection(true)
|
||||||
|
|
||||||
|
if not (self.doc:has_selection() and idx >= l1 and idx <= l2) then
|
||||||
|
renderer.draw_rect(x1, y, x2 - x1, self:get_line_height(), tmp)
|
||||||
|
renderer.draw_text(self:get_font(), str, x1, y + oy, text_color)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local draw_line_text = DocView.draw_line_text
|
||||||
|
|
||||||
|
function DocView:draw_line_text(idx, x, y)
|
||||||
|
draw_line_text(self, idx, x, y)
|
||||||
|
draw_color_previews(self, idx, x, y, "#(%x%x)(%x%x)(%x%x)%f[%W]", 16)
|
||||||
|
draw_color_previews(self, idx, x, y, "#(%x)(%x)(%x)%f[%W]", 16, true) -- support #fff css format
|
||||||
|
draw_color_previews(self, idx, x, y, "rgba?%((%d+)%D+(%d+)%D+(%d+).-%)", 10)
|
||||||
|
end
|
17
vendor/lite-plugins/plugins/copyfilelocation.lua
vendored
Normal file
17
vendor/lite-plugins/plugins/copyfilelocation.lua
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local config = require "core.config"
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["copy-file-location:copy-file-location"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
if not doc.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)
|
||||||
|
end
|
||||||
|
})
|
60
vendor/lite-plugins/plugins/datetimestamps.lua
vendored
Normal file
60
vendor/lite-plugins/plugins/datetimestamps.lua
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
local core = require "core"
|
||||||
|
local config = require "core.config"
|
||||||
|
local command = require "core.command"
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Date and time format placeholders
|
||||||
|
from https://www.lua.org/pil/22.1.html
|
||||||
|
%a abbreviated weekday name (e.g., Wed)
|
||||||
|
%A full weekday name (e.g., Wednesday)
|
||||||
|
%b abbreviated month name (e.g., Sep)
|
||||||
|
%B full month name (e.g., September)
|
||||||
|
%c date and time (e.g., 09/16/98 23:48:10)
|
||||||
|
%d day of the month (16) [01-31]
|
||||||
|
%H hour, using a 24-hour clock (23) [00-23]
|
||||||
|
%I hour, using a 12-hour clock (11) [01-12]
|
||||||
|
%M minute (48) [00-59]
|
||||||
|
%m month (09) [01-12]
|
||||||
|
%p either "am" or "pm" (pm)
|
||||||
|
%S second (10) [00-61]
|
||||||
|
%w weekday (3) [0-6 = Sunday-Saturday]
|
||||||
|
%x date (e.g., 09/16/98)
|
||||||
|
%X time (e.g., 23:48:10)
|
||||||
|
%Y full year (1998)
|
||||||
|
%y two-digit year (98) [00-99]
|
||||||
|
%% the character `%´
|
||||||
|
--]]
|
||||||
|
config.datetimestamps_format_datestamp = "%Y%m%d"
|
||||||
|
config.datetimestamps_format_datetimestamp = "%Y%m%d_%H%M%S"
|
||||||
|
config.datetimestamps_format_timestamp = "%H%M%S"
|
||||||
|
|
||||||
|
local function datestamp()
|
||||||
|
|
||||||
|
local sOut = os.date(config.datetimestamps_format_datestamp)
|
||||||
|
|
||||||
|
core.active_view.doc:text_input(sOut)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local function datetimestamp()
|
||||||
|
|
||||||
|
local sOut = os.date(config.datetimestamps_format_datetimestamp)
|
||||||
|
|
||||||
|
core.active_view.doc:text_input(sOut)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local function timestamp()
|
||||||
|
|
||||||
|
local sOut = os.date(config.datetimestamps_format_timestamp)
|
||||||
|
|
||||||
|
core.active_view.doc:text_input(sOut)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["datetimestamps:insert-datestamp"] = datestamp,
|
||||||
|
["datetimestamps:insert-timestamp"] = timestamp,
|
||||||
|
["datetimestamps:insert-datetimestamp"] = datetimestamp
|
||||||
|
})
|
||||||
|
|
64
vendor/lite-plugins/plugins/detectindent.lua
vendored
Normal file
64
vendor/lite-plugins/plugins/detectindent.lua
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
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
|
||||||
|
|
112
vendor/lite-plugins/plugins/dragdropselected.lua
vendored
Normal file
112
vendor/lite-plugins/plugins/dragdropselected.lua
vendored
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
--[[
|
||||||
|
dragdropselected.lua
|
||||||
|
provides basic drag and drop of selected text (in same document)
|
||||||
|
version: 20200627_133351
|
||||||
|
originally by SwissalpS
|
||||||
|
|
||||||
|
TODO: use OS drag and drop events
|
||||||
|
TODO: change mouse cursor when duplicating
|
||||||
|
TODO: add dragging image
|
||||||
|
--]]
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
local core = require "core"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
-- helper function for on_mouse_pressed to determine if mouse down is in selection
|
||||||
|
-- iLine is line number where mouse down happened
|
||||||
|
-- iCol is column where mouse down happened
|
||||||
|
-- iSelLine1 is line number where selection starts
|
||||||
|
-- iSelCol1 is column where selection starts
|
||||||
|
-- iSelLine2 is line number where selection ends
|
||||||
|
-- iSelCol2 is column where selection ends
|
||||||
|
local function isInSelection(iLine, iCol, iSelLine1, iSelCol1, iSelLine2, iSelCol2)
|
||||||
|
if iLine < iSelLine1 then return false end
|
||||||
|
if iLine > iSelLine2 then return false end
|
||||||
|
if (iLine == iSelLine1) and (iCol < iSelCol1) then return false end
|
||||||
|
if (iLine == iSelLine2) and (iCol > iSelCol2) then return false end
|
||||||
|
return true
|
||||||
|
end -- isInSelection
|
||||||
|
|
||||||
|
-- override DocView:on_mouse_moved
|
||||||
|
local on_mouse_moved = DocView.on_mouse_moved
|
||||||
|
function DocView:on_mouse_moved(x, y, ...)
|
||||||
|
|
||||||
|
local sCursor = nil
|
||||||
|
|
||||||
|
-- make sure we only act if previously on_mouse_pressed was in selection
|
||||||
|
if self.bClickedIntoSelection then
|
||||||
|
|
||||||
|
-- show that we are dragging something
|
||||||
|
sCursor = 'hand'
|
||||||
|
|
||||||
|
-- check for modifier to duplicate
|
||||||
|
-- (may want to set a flag as this only needs to be done once)
|
||||||
|
-- TODO: make image to drag with and/or hand over to OS dnd event
|
||||||
|
if not keymap.modkeys['ctrl'] then
|
||||||
|
-- TODO: maybe check if moved at all and only delete then or
|
||||||
|
-- as some editors do, only when dropped. I do like it going
|
||||||
|
-- instantly as that reduces the travel-distance.
|
||||||
|
self.doc:delete_to(0)
|
||||||
|
--sCursor = 'arrowWithPlus' -- 'handWithPlus'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- calculate line and column for current mouse position
|
||||||
|
local iLine, iCol = self:resolve_screen_position(x, y)
|
||||||
|
-- move text cursor
|
||||||
|
self.doc:set_selection(iLine, iCol)
|
||||||
|
-- update scroll position
|
||||||
|
self:scroll_to_line(iLine, true)
|
||||||
|
|
||||||
|
end -- if previously clicked into selection
|
||||||
|
|
||||||
|
-- hand off to 'old' on_mouse_moved()
|
||||||
|
on_mouse_moved(self, x, y, ...)
|
||||||
|
-- override cursor as needed
|
||||||
|
if sCursor then self.cursor = sCursor end
|
||||||
|
|
||||||
|
end -- DocView:on_mouse_moved
|
||||||
|
|
||||||
|
-- override DocView:on_mouse_pressed
|
||||||
|
local on_mouse_pressed = DocView.on_mouse_pressed
|
||||||
|
function DocView:on_mouse_pressed(button, x, y, clicks)
|
||||||
|
|
||||||
|
-- no need to proceed if not left button or has no selection
|
||||||
|
if ('left' ~= button)
|
||||||
|
or (not self.doc:has_selection())
|
||||||
|
or (1 < clicks) then
|
||||||
|
return on_mouse_pressed(self, button, x, y, clicks)
|
||||||
|
end
|
||||||
|
-- convert pixel coordinates to line and column coordinates
|
||||||
|
local iLine, iCol = self:resolve_screen_position(x, y)
|
||||||
|
-- get selection coordinates
|
||||||
|
local iSelLine1, iSelCol1, iSelLine2, iSelCol2 = self.doc:get_selection(true)
|
||||||
|
-- set flag for on_mouse_released and on_mouse_moved() methods to detect dragging
|
||||||
|
self.bClickedIntoSelection = isInSelection(iLine, iCol, iSelLine1, iSelCol1,
|
||||||
|
iSelLine2, iSelCol2)
|
||||||
|
if self.bClickedIntoSelection then
|
||||||
|
-- stash selection for inserting later
|
||||||
|
self.sDraggedText = self.doc:get_text(self.doc:get_selection())
|
||||||
|
else
|
||||||
|
-- let 'old' on_mouse_pressed() do whatever it needs to do
|
||||||
|
on_mouse_pressed(self, button, x, y, clicks)
|
||||||
|
end
|
||||||
|
|
||||||
|
end -- DocView:on_mouse_pressed
|
||||||
|
|
||||||
|
-- override DocView:on_mouse_released()
|
||||||
|
local on_mouse_released = DocView.on_mouse_released
|
||||||
|
function DocView:on_mouse_released(button)
|
||||||
|
|
||||||
|
if self.bClickedIntoSelection then
|
||||||
|
-- insert stashed selected text at current position
|
||||||
|
self.doc:text_input(self.sDraggedText)
|
||||||
|
-- unset stash and flag(s) TODO:
|
||||||
|
self.sDraggedText = ''
|
||||||
|
self.bClickedIntoSelection = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hand over to old handler
|
||||||
|
on_mouse_released(self, button)
|
||||||
|
|
||||||
|
end -- DocView:on_mouse_released
|
||||||
|
|
37
vendor/lite-plugins/plugins/drawwhitespace.lua
vendored
Normal file
37
vendor/lite-plugins/plugins/drawwhitespace.lua
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
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,
|
||||||
|
})
|
23
vendor/lite-plugins/plugins/eval.lua
vendored
Normal file
23
vendor/lite-plugins/plugins/eval.lua
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
|
||||||
|
|
||||||
|
local function eval(str)
|
||||||
|
local fn, err = load("return " .. str)
|
||||||
|
if not fn then fn, err = load(str) end
|
||||||
|
assert(fn, err)
|
||||||
|
return tostring(fn())
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["eval:insert"] = function()
|
||||||
|
core.command_view:enter("Evaluate And Insert Result", function(cmd)
|
||||||
|
core.active_view.doc:text_input(eval(cmd))
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
|
||||||
|
["eval:replace"] = function()
|
||||||
|
core.active_view.doc:replace(eval)
|
||||||
|
end,
|
||||||
|
})
|
45
vendor/lite-plugins/plugins/exec.lua
vendored
Normal file
45
vendor/lite-plugins/plugins/exec.lua
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
|
||||||
|
|
||||||
|
local function exec(cmd, keep_newline)
|
||||||
|
local fp = io.popen(cmd, "r")
|
||||||
|
local res = fp:read("*a")
|
||||||
|
fp:close()
|
||||||
|
return keep_newline and res or res:gsub("%\n$", "")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function shell_quote(str)
|
||||||
|
return "'" .. str:gsub("'", "'\\''") .. "'"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local printfb_sub = {
|
||||||
|
["\\"] = "\\\\",
|
||||||
|
["\0"] = "\\0000",
|
||||||
|
["'"] = "'\\''",
|
||||||
|
}
|
||||||
|
local function printfb_quote(str)
|
||||||
|
return "'" .. str:gsub(".", printfb_sub) .. "'"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["exec:insert"] = function()
|
||||||
|
core.command_view:enter("Insert Result Of Command", function(cmd)
|
||||||
|
core.active_view.doc:text_input(exec(cmd))
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
|
||||||
|
["exec:replace"] = function()
|
||||||
|
core.command_view:enter("Replace With Result Of Command", function(cmd)
|
||||||
|
core.active_view.doc:replace(function(str)
|
||||||
|
return exec(
|
||||||
|
"printf %b " .. printfb_quote(str:gsub("%\n$", "") .. "\n") .. " | eval '' " .. shell_quote(cmd),
|
||||||
|
str:find("%\n$")
|
||||||
|
)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
73
vendor/lite-plugins/plugins/ghmarkdown.lua
vendored
Normal file
73
vendor/lite-plugins/plugins/ghmarkdown.lua
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
|
||||||
|
local html = [[
|
||||||
|
<html>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin:80 auto 100 auto;
|
||||||
|
max-width: 750px;
|
||||||
|
line-height: 1.6;
|
||||||
|
font-family: Open Sans, Arial;
|
||||||
|
color: #444;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
h1, h2, h3 { line-height: 1.2; padding-top: 14px; }
|
||||||
|
hr { border: 0px; border-top: 1px solid #ddd; }
|
||||||
|
code, pre { background: #f3f3f3; padding: 8px; }
|
||||||
|
code { padding: 4px; }
|
||||||
|
a { text-decoration: none; color: #0366d6; }
|
||||||
|
a:hover { text-decoration: underline; }
|
||||||
|
table { border-collapse: collapse; }
|
||||||
|
table, th, td { border: 1px solid #ddd; padding: 6px; }
|
||||||
|
</style>
|
||||||
|
<head>
|
||||||
|
<title>${title}</title>
|
||||||
|
<head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var xhr = new XMLHttpRequest;
|
||||||
|
xhr.open("POST", "https://api.github.com/markdown/raw");
|
||||||
|
xhr.setRequestHeader("Content-Type", "text/plain");
|
||||||
|
xhr.onload = function() { document.body.innerHTML = xhr.responseText; };
|
||||||
|
xhr.send("${content}");
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["ghmarkdown:show-preview"] = function()
|
||||||
|
local dv = core.active_view
|
||||||
|
|
||||||
|
local content = dv.doc:get_text(1, 1, math.huge, math.huge)
|
||||||
|
local esc = { ['"'] = '\\"', ["\n"] = '\\n' }
|
||||||
|
local text = html:gsub("${(.-)}", {
|
||||||
|
title = dv:get_name(),
|
||||||
|
content = content:gsub(".", esc)
|
||||||
|
})
|
||||||
|
|
||||||
|
local htmlfile = core.temp_filename(".html")
|
||||||
|
local fp = io.open(htmlfile, "w")
|
||||||
|
fp:write(text)
|
||||||
|
fp:close()
|
||||||
|
|
||||||
|
core.log("Opening markdown preview for \"%s\"", dv:get_name())
|
||||||
|
if PLATFORM == "Windows" then
|
||||||
|
system.exec("start " .. htmlfile)
|
||||||
|
else
|
||||||
|
system.exec(string.format("xdg-open %q", htmlfile))
|
||||||
|
end
|
||||||
|
|
||||||
|
core.add_thread(function()
|
||||||
|
coroutine.yield(5)
|
||||||
|
os.remove(htmlfile)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
keymap.add { ["ctrl+shift+m"] = "ghmarkdown:show-preview" }
|
69
vendor/lite-plugins/plugins/gitstatus.lua
vendored
Normal file
69
vendor/lite-plugins/plugins/gitstatus.lua
vendored
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
local core = require "core"
|
||||||
|
local config = require "core.config"
|
||||||
|
local style = require "core.style"
|
||||||
|
local StatusView = require "core.statusview"
|
||||||
|
|
||||||
|
|
||||||
|
local git = {
|
||||||
|
branch = nil,
|
||||||
|
inserts = 0,
|
||||||
|
deletes = 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local function exec(cmd, wait)
|
||||||
|
local tempfile = core.temp_filename()
|
||||||
|
system.exec(string.format("%s > %q", cmd, tempfile))
|
||||||
|
coroutine.yield(wait)
|
||||||
|
local fp = io.open(tempfile)
|
||||||
|
local res = fp:read("*a")
|
||||||
|
fp:close()
|
||||||
|
os.remove(tempfile)
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
core.add_thread(function()
|
||||||
|
while true do
|
||||||
|
if system.get_file_info(".git") then
|
||||||
|
-- get branch name
|
||||||
|
git.branch = exec("git rev-parse --abbrev-ref HEAD", 1):match("[^\n]*")
|
||||||
|
|
||||||
|
-- get diff
|
||||||
|
local line = exec("git diff --stat", 1):match("[^\n]*%s*$")
|
||||||
|
git.inserts = tonumber(line:match("(%d+) ins")) or 0
|
||||||
|
git.deletes = tonumber(line:match("(%d+) del")) or 0
|
||||||
|
|
||||||
|
else
|
||||||
|
git.branch = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
coroutine.yield(config.project_scan_rate)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
local get_items = StatusView.get_items
|
||||||
|
|
||||||
|
function StatusView:get_items()
|
||||||
|
if not git.branch then
|
||||||
|
return get_items(self)
|
||||||
|
end
|
||||||
|
local left, right = get_items(self)
|
||||||
|
|
||||||
|
local t = {
|
||||||
|
style.dim, self.separator,
|
||||||
|
(git.inserts ~= 0 or git.deletes ~= 0) and style.accent or style.text,
|
||||||
|
git.branch,
|
||||||
|
style.dim, " ",
|
||||||
|
git.inserts ~= 0 and style.accent or style.text, "+", git.inserts,
|
||||||
|
style.dim, " / ",
|
||||||
|
git.deletes ~= 0 and style.accent or style.text, "-", git.deletes,
|
||||||
|
}
|
||||||
|
for _, item in ipairs(t) do
|
||||||
|
table.insert(right, item)
|
||||||
|
end
|
||||||
|
|
||||||
|
return left, right
|
||||||
|
end
|
||||||
|
|
49
vendor/lite-plugins/plugins/gofmt.lua
vendored
Normal file
49
vendor/lite-plugins/plugins/gofmt.lua
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
local function exec(cmd)
|
||||||
|
local fp = io.popen(cmd, "r")
|
||||||
|
local res = fp:read("*a")
|
||||||
|
local success = fp:close()
|
||||||
|
return res:gsub("%\n$", ""), success
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_cmd_text(cmd, doc)
|
||||||
|
local active_filename = doc and system.absolute_path(doc.filename or "")
|
||||||
|
return exec(string.format("%s %s", cmd, active_filename))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_doc(cmd, doc)
|
||||||
|
local text, success = get_cmd_text(cmd, doc)
|
||||||
|
if success == nil then
|
||||||
|
local err_text = "Command '%s' not found in the system"
|
||||||
|
core.error(string.format(err_text, cmd))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local sel = { doc:get_selection() }
|
||||||
|
doc:remove(1, 1, math.huge, math.huge)
|
||||||
|
doc:insert(1, 1, text)
|
||||||
|
doc:set_selection(table.unpack(sel))
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["gofmt:gofmt"] = function()
|
||||||
|
update_doc("gofmt", core.active_view.doc)
|
||||||
|
end,
|
||||||
|
|
||||||
|
["gofmt:goimports"] = function()
|
||||||
|
update_doc("goimports", core.active_view.doc)
|
||||||
|
end,
|
||||||
|
|
||||||
|
["gofmt:goreturns"] = function()
|
||||||
|
update_doc("goreturns", core.active_view.doc)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["ctrl+i"] = "gofmt:gofmt",
|
||||||
|
["ctrl+h"] = "gofmt:goimports",
|
||||||
|
["ctrl+u"] = "gofmt:goreturns",
|
||||||
|
}
|
5
vendor/lite-plugins/plugins/hidelinenumbers.lua
vendored
Normal file
5
vendor/lite-plugins/plugins/hidelinenumbers.lua
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
local style = require "core.style"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
DocView.draw_line_gutter = function() end
|
||||||
|
DocView.get_gutter_width = function() return style.padding.x end
|
18
vendor/lite-plugins/plugins/hidestatus.lua
vendored
Normal file
18
vendor/lite-plugins/plugins/hidestatus.lua
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local command = require "core.command"
|
||||||
|
local StatusView = require "core.statusview"
|
||||||
|
|
||||||
|
local visible = false
|
||||||
|
local funcs = {
|
||||||
|
[true] = StatusView.update,
|
||||||
|
[false] = function(self) self.size.y = 0 end,
|
||||||
|
}
|
||||||
|
|
||||||
|
function StatusView:update(...)
|
||||||
|
funcs[visible](self, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add(nil, {
|
||||||
|
["hide-status:toggle"] = function() visible = not visible end,
|
||||||
|
["hide-status:hide"] = function() visible = false end,
|
||||||
|
["hide-status:show"] = function() visible = true end,
|
||||||
|
})
|
12
vendor/lite-plugins/plugins/inanimate.lua
vendored
Normal file
12
vendor/lite-plugins/plugins/inanimate.lua
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
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
|
45
vendor/lite-plugins/plugins/indentguide.lua
vendored
Normal file
45
vendor/lite-plugins/plugins/indentguide.lua
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
local style = require "core.style"
|
||||||
|
local config = require "core.config"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
|
||||||
|
local function get_line_spaces(doc, idx, dir)
|
||||||
|
local text = doc.lines[idx]
|
||||||
|
if not text then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
local s, e = text:find("^%s*")
|
||||||
|
if e == #text then
|
||||||
|
return get_line_spaces(doc, idx + dir, dir)
|
||||||
|
end
|
||||||
|
local n = 0
|
||||||
|
for i = s, e do
|
||||||
|
n = n + (text:byte(i) == 9 and config.indent_size or 1)
|
||||||
|
end
|
||||||
|
return n
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_line_indent_guide_spaces(doc, idx)
|
||||||
|
if doc.lines[idx]:find("^%s*\n") then
|
||||||
|
return math.max(
|
||||||
|
get_line_spaces(doc, idx - 1, -1),
|
||||||
|
get_line_spaces(doc, idx + 1, 1))
|
||||||
|
end
|
||||||
|
return get_line_spaces(doc, idx)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
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 color = style.guide or style.selection
|
||||||
|
renderer.draw_rect(x + sw * i, y, w, h, color)
|
||||||
|
end
|
||||||
|
draw_line_text(self, idx, x, y)
|
||||||
|
end
|
86
vendor/lite-plugins/plugins/language_angelscript.lua
vendored
Normal file
86
vendor/lite-plugins/plugins/language_angelscript.lua
vendored
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.as$", "%.asc$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0[xX]%x+", type = "number" },
|
||||||
|
{ pattern = "-?0[bB][0-1]+", type = "number" },
|
||||||
|
{ pattern = "-?0[oO][0-7]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "&inout", type = "keyword" },
|
||||||
|
{ pattern = "&in", type = "keyword" },
|
||||||
|
{ pattern = "&out", type = "keyword" },
|
||||||
|
{ pattern = "[%a_][%w_]*@", type = "keyword2" },
|
||||||
|
{ pattern = "[%-%+!~@%?:&|%^<>%*/=%%]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
-- Common
|
||||||
|
["shared"] = "keyword",
|
||||||
|
["external"] = "keyword",
|
||||||
|
["private"] = "keyword",
|
||||||
|
["protected"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["final"] = "keyword",
|
||||||
|
["abstract"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["typedef"] = "keyword",
|
||||||
|
["namespace"] = "keyword",
|
||||||
|
["interface"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["funcdef"] = "keyword",
|
||||||
|
["get"] = "keyword",
|
||||||
|
["set"] = "keyword",
|
||||||
|
["mixin"] = "keyword",
|
||||||
|
["void"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["int8"] = "keyword2",
|
||||||
|
["int16"] = "keyword2",
|
||||||
|
["int32"] = "keyword2",
|
||||||
|
["int64"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["uint8"] = "keyword2",
|
||||||
|
["uint16"] = "keyword2",
|
||||||
|
["uint32"] = "keyword2",
|
||||||
|
["uint64"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["auto"] = "keyword",
|
||||||
|
["override"] = "keyword",
|
||||||
|
["explicit"] = "keyword",
|
||||||
|
["property"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["cast"] = "keyword",
|
||||||
|
["function"] = "keyword",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["null"] = "literal",
|
||||||
|
["is"] = "operator",
|
||||||
|
["and"] = "operator",
|
||||||
|
["or"] = "operator",
|
||||||
|
["xor"] = "operator",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
61
vendor/lite-plugins/plugins/language_batch.lua
vendored
Normal file
61
vendor/lite-plugins/plugins/language_batch.lua
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
-- batch syntax for lite <liqube>
|
||||||
|
|
||||||
|
-- windows batch files use caseless matching for symbols
|
||||||
|
local symtable = {
|
||||||
|
["keyword"] = {
|
||||||
|
"if", "else", "elsif", "not", "for", "do", "in",
|
||||||
|
"equ", "neq", "lss", "leq", "gtr", "geq", -- == != < <= > >=
|
||||||
|
"nul", "con", "prn", "prn", "lpt1", "com1", "com2", "com3", "com4",
|
||||||
|
"exist", "defined",
|
||||||
|
"errorlevel", "cmdextversion",
|
||||||
|
"goto", "call", "verify",
|
||||||
|
},
|
||||||
|
["function"] = {
|
||||||
|
"set", "setlocal", "endlocal", "enabledelayedexpansion",
|
||||||
|
"echo", "type",
|
||||||
|
"cd", "chdir",
|
||||||
|
"md", "mkdir",
|
||||||
|
"pause", "choice", "exit",
|
||||||
|
"del", "rd", "rmdir",
|
||||||
|
"copy", "xcopy",
|
||||||
|
"move", "ren",
|
||||||
|
"find", "findstr",
|
||||||
|
"sort", "shift", "attrib",
|
||||||
|
"cmd", "command",
|
||||||
|
"forfiles",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
-- prepare a mixed symbol list
|
||||||
|
local function prepare_symbols(symtable)
|
||||||
|
local symbols = { }
|
||||||
|
for symtype, symlist in pairs(symtable) do
|
||||||
|
for _, symname in ipairs(symlist) do
|
||||||
|
symbols[symname:lower()] = symtype
|
||||||
|
symbols[symname:upper()] = symtype
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return symbols
|
||||||
|
end
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.bat$", "%.cmd$" },
|
||||||
|
comment = "rem",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "@echo off\n", type = "keyword" },
|
||||||
|
{ pattern = "@echo on\n", type = "keyword" },
|
||||||
|
{ pattern = "rem.-\n", type = "comment" }, -- rem comment line, rem, rem.
|
||||||
|
{ pattern = "REM.-\n", type = "comment" },
|
||||||
|
{ pattern = "%s*:[%w%-]+", type = "symbol" }, -- :labels
|
||||||
|
{ pattern = "%:%:.-\n", type = "comment" }, -- :: comment line
|
||||||
|
{ pattern = "%%%w+%%", type = "symbol" }, -- %variable%
|
||||||
|
{ pattern = "%%%%?~?[%w:]+", type = "symbol" }, -- %1, %~dpn1, %~1:2, %%i, %%~i
|
||||||
|
{ pattern = "[!=()%>&%^/\\@]", type = "operator" }, -- operators
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" }, -- integer numbers
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" }, -- "strings"
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "normal" },
|
||||||
|
{ pattern = ":eof", type = "keyword" }, -- not quite as intended, but ok for now
|
||||||
|
},
|
||||||
|
symbols = prepare_symbols(symtable),
|
||||||
|
}
|
15
vendor/lite-plugins/plugins/language_cmake.lua
vendored
Normal file
15
vendor/lite-plugins/plugins/language_cmake.lua
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.cmake$", "CMakeLists.txt$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "normal" },
|
||||||
|
{ pattern = "%${[%a_][%w_]*%}", type = "operator" },
|
||||||
|
},
|
||||||
|
symbols = {},
|
||||||
|
}
|
121
vendor/lite-plugins/plugins/language_cpp.lua
vendored
Normal file
121
vendor/lite-plugins/plugins/language_cpp.lua
vendored
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
pcall(require, "plugins.language_c")
|
||||||
|
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = {
|
||||||
|
"%.h$", "%.inl$", "%.cpp$", "%.cc$", "%.C$", "%.cxx$",
|
||||||
|
"%.c++$", "%.hh$", "%.H$", "%.hxx$", "%.hpp$", "%.h++$"
|
||||||
|
},
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%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 = {
|
||||||
|
["alignof"] = "keyword",
|
||||||
|
["alignas"] = "keyword",
|
||||||
|
["and"] = "keyword",
|
||||||
|
["and_eq"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["not_eq"] = "keyword",
|
||||||
|
["or"] = "keyword",
|
||||||
|
["or_eq"] = "keyword",
|
||||||
|
["xor"] = "keyword",
|
||||||
|
["xor_eq"] = "keyword",
|
||||||
|
["private"] = "keyword",
|
||||||
|
["protected"] = "keyword",
|
||||||
|
["public"] = "keyword",
|
||||||
|
["register"] = "keyword",
|
||||||
|
["nullptr"] = "keyword",
|
||||||
|
["operator"] = "keyword",
|
||||||
|
["asm"] = "keyword",
|
||||||
|
["bitand"] = "keyword",
|
||||||
|
["bitor"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["throw"] = "keyword",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["compl"] = "keyword",
|
||||||
|
["explicit"] = "keyword",
|
||||||
|
["export"] = "keyword",
|
||||||
|
["concept"] = "keyword",
|
||||||
|
["consteval"] = "keyword",
|
||||||
|
["constexpr"] = "keyword",
|
||||||
|
["constinit"] = "keyword",
|
||||||
|
["const_cast"] = "keyword",
|
||||||
|
["dynamic_cast"] = "keyword",
|
||||||
|
["reinterpret_cast"] = "keyword",
|
||||||
|
["static_cast"] = "keyword",
|
||||||
|
["static_assert"] = "keyword",
|
||||||
|
["template"] = "keyword",
|
||||||
|
["this"] = "keyword",
|
||||||
|
["thread_local"] = "keyword",
|
||||||
|
["requires"] = "keyword",
|
||||||
|
["co_wait"] = "keyword",
|
||||||
|
["co_return"] = "keyword",
|
||||||
|
["co_yield"] = "keyword",
|
||||||
|
["decltype"] = "keyword",
|
||||||
|
["delete"] = "keyword",
|
||||||
|
["export"] = "keyword",
|
||||||
|
["friend"] = "keyword",
|
||||||
|
["typeid"] = "keyword",
|
||||||
|
["typename"] = "keyword",
|
||||||
|
["mutable"] = "keyword",
|
||||||
|
["virtual"] = "keyword",
|
||||||
|
["using"] = "keyword",
|
||||||
|
["namespace"] = "keyword",
|
||||||
|
["new"] = "keyword",
|
||||||
|
["noexcept"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["elseif"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["goto"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["union"] = "keyword",
|
||||||
|
["typedef"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["extern"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["volatile"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["inline"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["auto"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["void"] = "keyword",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["short"] = "keyword2",
|
||||||
|
["long"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["char"] = "keyword2",
|
||||||
|
["unsigned"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["true"] = "keyword2",
|
||||||
|
["false"] = "keyword2",
|
||||||
|
["wchar_t"] = "keyword2",
|
||||||
|
["char8_t"] = "keyword2",
|
||||||
|
["char16_t"] = "keyword2",
|
||||||
|
["char32_t"] = "keyword2",
|
||||||
|
["NULL"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
112
vendor/lite-plugins/plugins/language_csharp.lua
vendored
Normal file
112
vendor/lite-plugins/plugins/language_csharp.lua
vendored
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = "%.cs$",
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "[%$%@]?\"", '"', '\\' }, type = "string" }, -- string interpolation and verbatim
|
||||||
|
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence
|
||||||
|
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence
|
||||||
|
{ pattern = "'\\?.'", type = "string" }, -- character literal
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
|
||||||
|
{ pattern = "%?%?", type = "operator" }, -- ?? null-coalescing
|
||||||
|
{ pattern = "%?%.", type = "operator" }, -- ?. null-conditional
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
-- keywords
|
||||||
|
["abstract"] = "keyword",
|
||||||
|
["as"] = "keyword",
|
||||||
|
["await"] = "keyword",
|
||||||
|
["base"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["checked"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["delegate"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["event"] = "keyword",
|
||||||
|
["explicit"] = "keyword",
|
||||||
|
["extern"] = "keyword",
|
||||||
|
["finally"] = "keyword",
|
||||||
|
["fixed"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["foreach"] = "keyword",
|
||||||
|
["get"] = "keyword",
|
||||||
|
["goto"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["implicit"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["interface"] = "keyword",
|
||||||
|
["internal"] = "keyword",
|
||||||
|
["is"] = "keyword",
|
||||||
|
["lock"] = "keyword",
|
||||||
|
["namespace"] = "keyword",
|
||||||
|
["new"] = "keyword",
|
||||||
|
["operator"] = "keyword",
|
||||||
|
["out"] = "keyword",
|
||||||
|
["override"] = "keyword",
|
||||||
|
["params"] = "keyword",
|
||||||
|
["private"] = "keyword",
|
||||||
|
["protected"] = "keyword",
|
||||||
|
["public"] = "keyword",
|
||||||
|
["readonly"] = "keyword",
|
||||||
|
["ref"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["sealed"] = "keyword",
|
||||||
|
["set"] = "keyword",
|
||||||
|
["sizeof"] = "keyword",
|
||||||
|
["stackalloc"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["this"] = "keyword",
|
||||||
|
["throw"] = "keyword",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["typeof"] = "keyword",
|
||||||
|
["unchecked"] = "keyword",
|
||||||
|
["unsafe"] = "keyword",
|
||||||
|
["using"] = "keyword",
|
||||||
|
["var"] = "keyword",
|
||||||
|
["virtual"] = "keyword",
|
||||||
|
["void"] = "keyword",
|
||||||
|
["volatile"] = "keyword",
|
||||||
|
["where"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["yield"] = "keyword",
|
||||||
|
-- types
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["byte"] = "keyword2",
|
||||||
|
["char"] = "keyword2",
|
||||||
|
["decimal"] = "keyword2",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["long"] = "keyword2",
|
||||||
|
["object"] = "keyword2",
|
||||||
|
["sbyte"] = "keyword2",
|
||||||
|
["short"] = "keyword2",
|
||||||
|
["string"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["ulong"] = "keyword2",
|
||||||
|
["ushort"] = "keyword2",
|
||||||
|
-- literals
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["null"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
135
vendor/lite-plugins/plugins/language_d.lua
vendored
Normal file
135
vendor/lite-plugins/plugins/language_d.lua
vendored
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.d$", "%.di$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "/%+", "%+/" }, type = "comment" },
|
||||||
|
{ pattern = { '`', '`', '\\' }, type = "string" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&%$]+", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*!", type = "function" }, -- highlight templates
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
{ pattern = "@safe", type = "keyword" },
|
||||||
|
{ pattern = "@trusted", type = "keyword" },
|
||||||
|
{ pattern = "@nogc", type = "keyword" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["abstract"] = "keyword",
|
||||||
|
["alias"] = "keyword",
|
||||||
|
["align"] = "keyword",
|
||||||
|
["asm"] = "keyword",
|
||||||
|
["assert"] = "keyword",
|
||||||
|
["auto"] = "keyword",
|
||||||
|
["body"] = "keyword",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["byte"] = "keyword2",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["cast"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["cdouble"] = "keyword2",
|
||||||
|
["cent"] = "keyword2",
|
||||||
|
["cfloat"] = "keyword2",
|
||||||
|
["char"] = "keyword2",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["creal"] = "keyword2",
|
||||||
|
["dchar"] = "keyword2",
|
||||||
|
["debug"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["delegate"] = "keyword",
|
||||||
|
["deprecated"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["export"] = "keyword",
|
||||||
|
["extern"] = "keyword",
|
||||||
|
["false"] = "literal",
|
||||||
|
["final"] = "keyword",
|
||||||
|
["finally"] = "keyword",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["foreach"] = "keyword",
|
||||||
|
["foreach_reverse"] = "keyword",
|
||||||
|
["function"] = "keyword",
|
||||||
|
["goto"] = "keyword",
|
||||||
|
["idouble"] = "keyword2",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["ifloat"] = "keyword2",
|
||||||
|
["immutable"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["inout"] = "keyword",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["interface"] = "keyword",
|
||||||
|
["invariant"] = "keyword",
|
||||||
|
["ireal"] = "keyword2",
|
||||||
|
["is"] = "keyword",
|
||||||
|
["lazy"] = "keyword",
|
||||||
|
["long"] = "keyword2",
|
||||||
|
["macro"] = "keyword",
|
||||||
|
["mixin"] = "keyword",
|
||||||
|
["module"] = "keyword",
|
||||||
|
["new"] = "keyword",
|
||||||
|
["nothrow"] = "keyword",
|
||||||
|
["null"] = "literal",
|
||||||
|
["out"] = "keyword",
|
||||||
|
["override"] = "keyword",
|
||||||
|
["package"] = "keyword",
|
||||||
|
["pragma"] = "keyword",
|
||||||
|
["private"] = "keyword",
|
||||||
|
["protected"] = "keyword",
|
||||||
|
["public"] = "keyword",
|
||||||
|
["pure"] = "keyword",
|
||||||
|
["real"] = "keyword2",
|
||||||
|
["ref"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["scope"] = "keyword",
|
||||||
|
["shared"] = "keyword",
|
||||||
|
["short"] = "keyword2",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["super"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["synchronized"] = "keyword",
|
||||||
|
["template"] = "keyword",
|
||||||
|
["this"] = "keyword",
|
||||||
|
["throw"] = "keyword",
|
||||||
|
["true"] = "literal",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["typeid"] = "keyword",
|
||||||
|
["typeof"] = "keyword",
|
||||||
|
["ubyte"] = "keyword2",
|
||||||
|
["ucent"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["ulong"] = "keyword2",
|
||||||
|
["union"] = "keyword",
|
||||||
|
["unittest"] = "keyword",
|
||||||
|
["ushort"] = "keyword2",
|
||||||
|
["version"] = "keyword",
|
||||||
|
["void"] = "keyword",
|
||||||
|
["wchar"] = "keyword2",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["with"] = "keyword",
|
||||||
|
["__FILE__"] = "keyword",
|
||||||
|
["__FILE_FULL_PATH__"] = "keyword",
|
||||||
|
["__MODULE__"] = "keyword",
|
||||||
|
["__LINE__"] = "keyword",
|
||||||
|
["__FUNCTION__"] = "keyword",
|
||||||
|
["__PRETTY_FUNCTION__"] = "keyword",
|
||||||
|
["__gshared"] = "keyword",
|
||||||
|
["__traits"] = "keyword",
|
||||||
|
["__vector"] = "keyword",
|
||||||
|
["__parameters"] = "keyword",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
92
vendor/lite-plugins/plugins/language_elixir.lua
vendored
Normal file
92
vendor/lite-plugins/plugins/language_elixir.lua
vendored
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.ex$", "%.exs$"},
|
||||||
|
comment = "#",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "#.*\n", type = "comment" },
|
||||||
|
{ pattern = { ':"', '"', '\\' }, type = "number" },
|
||||||
|
{ pattern = { '"""', '"""', '\\' }, type = "string" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = { '~%a[/"|\'%(%[%{<]', '[/"|\'%)%]%}>]', '\\' }, type = "string"},
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = ':"?[%a_][%w_]*"?', type = "number" },
|
||||||
|
{ pattern = "[%a][%w_!?]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "%u%w+", type = "normal" },
|
||||||
|
{ pattern = "@[%a_][%w_]*", type = "keyword2" },
|
||||||
|
{ pattern = "_%a[%w_]*", type = "keyword2" },
|
||||||
|
{ pattern = "[%+%-=/%*<>!|&]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["def"] = "keyword",
|
||||||
|
["defp"] = "keyword",
|
||||||
|
["defguard"] = "keyword",
|
||||||
|
["defguardp"] = "keyword",
|
||||||
|
["defmodule"] = "keyword",
|
||||||
|
["defprotocol"] = "keyword",
|
||||||
|
["defimpl"] = "keyword",
|
||||||
|
["defrecord"] = "keyword",
|
||||||
|
["defrecordp"] = "keyword",
|
||||||
|
["defmacro"] = "keyword",
|
||||||
|
["defmacrop"] = "keyword",
|
||||||
|
["defdelegate"] = "keyword",
|
||||||
|
["defoverridable"] = "keyword",
|
||||||
|
["defexception"] = "keyword",
|
||||||
|
["defcallback"] = "keyword",
|
||||||
|
["defstruct"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["when"] = "keyword",
|
||||||
|
["with"] = "keyword",
|
||||||
|
["cond"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["unless"] = "keyword",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["receive"] = "keyword",
|
||||||
|
["after"] = "keyword",
|
||||||
|
["raise"] = "keyword",
|
||||||
|
["rescue"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["quote"] = "keyword",
|
||||||
|
["unquote"] = "keyword",
|
||||||
|
["super"] = "keyword",
|
||||||
|
["unquote_splicing"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["end"] = "keyword",
|
||||||
|
["fn"] = "keyword",
|
||||||
|
["import"] = "keyword2",
|
||||||
|
["alias"] = "keyword2",
|
||||||
|
["use"] = "keyword2",
|
||||||
|
["require"] = "keyword2",
|
||||||
|
["and"] = "operator",
|
||||||
|
["or"] = "operator",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["nil"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.l?eex$" },
|
||||||
|
patterns = {
|
||||||
|
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" },
|
||||||
|
{ pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" },
|
||||||
|
{ pattern = { '<%%=?', '%%>' }, 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 = {},
|
||||||
|
}
|
47
vendor/lite-plugins/plugins/language_elm.lua
vendored
Normal file
47
vendor/lite-plugins/plugins/language_elm.lua
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.elm$" },
|
||||||
|
comment = "%-%-",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = {"%-%-", "\n"}, type = "comment" },
|
||||||
|
{ pattern = { "{%-", "%-}" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { '"""', '"""', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "%.%.", type = "operator" },
|
||||||
|
{ pattern = "[=:|&<>%+%-%*\\/%^%%]", type = "operator" },
|
||||||
|
{ pattern = "[%a_'][%w_']*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["as"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["of"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["module"] = "keyword",
|
||||||
|
["exposing"] = "keyword",
|
||||||
|
["let"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["type"] = "keyword",
|
||||||
|
["alias"] = "keyword",
|
||||||
|
["port"] = "keyword",
|
||||||
|
["and"] = "keyword",
|
||||||
|
["or"] = "keyword",
|
||||||
|
["xor"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["number"] = "keyword2",
|
||||||
|
["Bool"] = "keyword2",
|
||||||
|
["Char"] = "keyword2",
|
||||||
|
["Float"] = "keyword2",
|
||||||
|
["Int"] = "keyword2",
|
||||||
|
["String"] = "keyword2",
|
||||||
|
["True"] = "literal",
|
||||||
|
["False"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
33
vendor/lite-plugins/plugins/language_fe.lua
vendored
Normal file
33
vendor/lite-plugins/plugins/language_fe.lua
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = "%.fe$",
|
||||||
|
comment = ";",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = ";.-\n", type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = "0x[%da-fA-F]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.]*", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+", type = "number" },
|
||||||
|
{ pattern = "'", type = "symbol" },
|
||||||
|
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
|
||||||
|
{ pattern = "[^()'%s\"]+", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["if"] = "keyword2",
|
||||||
|
["let"] = "keyword2",
|
||||||
|
["do"] = "keyword2",
|
||||||
|
["fn"] = "keyword2",
|
||||||
|
["mac"] = "keyword2",
|
||||||
|
["'"] = "keyword2",
|
||||||
|
["print"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["car"] = "keyword",
|
||||||
|
["cdr"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["setcdr"] = "keyword",
|
||||||
|
["setcar"] = "keyword",
|
||||||
|
["nil"] = "literal",
|
||||||
|
["t"] = "literal",
|
||||||
|
}
|
||||||
|
}
|
100
vendor/lite-plugins/plugins/language_fennel.lua
vendored
Normal file
100
vendor/lite-plugins/plugins/language_fennel.lua
vendored
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
-- Support for the Fennel programming language: https://fennel-lang.org
|
||||||
|
-- Covers all the keywords up to Fennel version 0.4.0
|
||||||
|
|
||||||
|
-- Currently only covers highlighting, not indentation, delimiter
|
||||||
|
-- matching, or evaluation.
|
||||||
|
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = "%.fnl$",
|
||||||
|
comment = ";",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = ";.-\n", type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = "0x[%da-fA-F]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.]*", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+", type = "number" },
|
||||||
|
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
|
||||||
|
{ pattern = "[^()'%s\"]+", type = "symbol" },
|
||||||
|
},
|
||||||
|
|
||||||
|
symbols = {
|
||||||
|
["eval-compiler"] = "keyword2",
|
||||||
|
["doc"] = "keyword2",
|
||||||
|
["lua"] = "keyword2",
|
||||||
|
["hashfn"] = "keyword2",
|
||||||
|
["macro"] = "keyword2",
|
||||||
|
["macros"] = "keyword2",
|
||||||
|
["import-macros"] = "keyword2",
|
||||||
|
["do"] = "keyword2",
|
||||||
|
["values"] = "keyword2",
|
||||||
|
["if"] = "keyword2",
|
||||||
|
["when"] = "keyword2",
|
||||||
|
["each"] = "keyword2",
|
||||||
|
["for"] = "keyword2",
|
||||||
|
["fn"] = "keyword2",
|
||||||
|
["lambda"] = "keyword2",
|
||||||
|
["λ"] = "keyword2",
|
||||||
|
["partial"] = "keyword2",
|
||||||
|
["while"] = "keyword2",
|
||||||
|
["set"] = "keyword2",
|
||||||
|
["global"] = "keyword2",
|
||||||
|
["var"] = "keyword2",
|
||||||
|
["local"] = "keyword2",
|
||||||
|
["let"] = "keyword2",
|
||||||
|
["tset"] = "keyword2",
|
||||||
|
["set-forcibly!"] = "keyword2",
|
||||||
|
["doto"] = "keyword2",
|
||||||
|
["match"] = "keyword2",
|
||||||
|
["or"] = "keyword2",
|
||||||
|
["and"] = "keyword2",
|
||||||
|
["not"] = "keyword2",
|
||||||
|
["not="] = "keyword2",
|
||||||
|
["pick-args"] = "keyword2",
|
||||||
|
["pick-values"] = "keyword2",
|
||||||
|
["macrodebug"] = "keyword2",
|
||||||
|
|
||||||
|
["."] = "keyword",
|
||||||
|
["+"] = "keyword",
|
||||||
|
[".."] = "keyword",
|
||||||
|
["^"] = "keyword",
|
||||||
|
["-"] = "keyword",
|
||||||
|
["*"] = "keyword",
|
||||||
|
["%"] = "keyword",
|
||||||
|
["/"] = "keyword",
|
||||||
|
[">"] = "keyword",
|
||||||
|
["<"] = "keyword",
|
||||||
|
[">="] = "keyword",
|
||||||
|
["<="] = "keyword",
|
||||||
|
["="] = "keyword",
|
||||||
|
["#"] = "keyword",
|
||||||
|
["..."] = "keyword",
|
||||||
|
[":"] = "keyword",
|
||||||
|
["->"] = "keyword",
|
||||||
|
["->>"] = "keyword",
|
||||||
|
["-?>"] = "keyword",
|
||||||
|
["-?>>"] = "keyword",
|
||||||
|
["$"] = "keyword",
|
||||||
|
["$1"] = "keyword",
|
||||||
|
["$2"] = "keyword",
|
||||||
|
["$3"] = "keyword",
|
||||||
|
["$4"] = "keyword",
|
||||||
|
["$5"] = "keyword",
|
||||||
|
["$6"] = "keyword",
|
||||||
|
["$7"] = "keyword",
|
||||||
|
["$8"] = "keyword",
|
||||||
|
["$9"] = "keyword",
|
||||||
|
|
||||||
|
["lshift"] = "keyword",
|
||||||
|
["rshift"] = "keyword",
|
||||||
|
["bor"] = "keyword",
|
||||||
|
["band"] = "keyword",
|
||||||
|
["bnot"] = "keyword",
|
||||||
|
["bxor"] = "keyword",
|
||||||
|
|
||||||
|
["nil"] = "literal",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
}
|
||||||
|
}
|
99
vendor/lite-plugins/plugins/language_gdscript.lua
vendored
Normal file
99
vendor/lite-plugins/plugins/language_gdscript.lua
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
-- Support for the GDScript programming language: https://godotengine.org/
|
||||||
|
-- Covers the most used keywords up to Godot version 3.2.x
|
||||||
|
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.gd$" },
|
||||||
|
comment = "#",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "#.-\n", type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%x*", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.e]*", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+", type = "number" },
|
||||||
|
{ pattern = "[%+%:%-=/%*%^%%<>!~|&]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
-- keywords
|
||||||
|
["if"] = "keyword",
|
||||||
|
["elif"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["match"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["pass"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["class_name"] = "keyword",
|
||||||
|
["extends"] = "keyword",
|
||||||
|
["is"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["as"] = "keyword",
|
||||||
|
["and"] = "keyword",
|
||||||
|
["or"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["self"] = "keyword",
|
||||||
|
["tool"] = "keyword",
|
||||||
|
["signal"] = "keyword",
|
||||||
|
["func"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["var"] = "keyword",
|
||||||
|
["onready"] = "keyword",
|
||||||
|
["export"] = "keyword",
|
||||||
|
["setget"] = "keyword",
|
||||||
|
["breakpoint"] = "keyword",
|
||||||
|
["preload"] = "keyword",
|
||||||
|
["yield"] = "keyword",
|
||||||
|
["assert"] = "keyword",
|
||||||
|
["remote"] = "keyword",
|
||||||
|
["master"] = "keyword",
|
||||||
|
["puppet"] = "keyword",
|
||||||
|
["remotesync"] = "keyword",
|
||||||
|
["mastersync"] = "keyword",
|
||||||
|
["puppetsync"] = "keyword",
|
||||||
|
-- types
|
||||||
|
["void"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["String"] = "keyword2",
|
||||||
|
["Vector2"] = "keyword2",
|
||||||
|
["Rect2"] = "keyword2",
|
||||||
|
["Vector3"] = "keyword2",
|
||||||
|
["Transform2D"] = "keyword2",
|
||||||
|
["Plane"] = "keyword2",
|
||||||
|
["Quat"] = "keyword2",
|
||||||
|
["AABB"] = "keyword2",
|
||||||
|
["Basis"] = "keyword2",
|
||||||
|
["Transform"] = "keyword2",
|
||||||
|
["Color"] = "keyword2",
|
||||||
|
["NodePath"] = "keyword2",
|
||||||
|
["RID"] = "keyword2",
|
||||||
|
["Object"] = "keyword2",
|
||||||
|
["Array"] = "keyword2",
|
||||||
|
["PoolByteArray"] = "keyword2",
|
||||||
|
["PoolIntArray"] = "keyword2",
|
||||||
|
["PoolRealArray"] = "keyword2",
|
||||||
|
["PoolStringArray"] = "keyword2",
|
||||||
|
["PoolVector2Array"] = "keyword2",
|
||||||
|
["PoolVector3Array"] = "keyword2",
|
||||||
|
["PoolColorArray"] = "keyword2",
|
||||||
|
["Dictionary"] = "keyword2",
|
||||||
|
-- literals
|
||||||
|
["null"] = "literal",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["PI"] = "literal",
|
||||||
|
["TAU"] = "literal",
|
||||||
|
["INF"] = "literal",
|
||||||
|
["NAN"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
387
vendor/lite-plugins/plugins/language_glsl.lua
vendored
Normal file
387
vendor/lite-plugins/plugins/language_glsl.lua
vendored
Normal file
|
@ -0,0 +1,387 @@
|
||||||
|
|
||||||
|
local style = require "core.style"
|
||||||
|
local common = require "core.common"
|
||||||
|
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.glsl$", "%.frag$", "%.vert$", },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
|
||||||
|
|
||||||
|
{ pattern = "ivec[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "bvec[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "uvec[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "vec[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "dmat[2-4]x[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "dmat[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "mat[2-4]x[2-4]", type = "keyword2" },
|
||||||
|
{ pattern = "mat[2-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
--https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
|
||||||
|
--The symbols are added here in the order they appear in the spec
|
||||||
|
["if"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["void"] = "keyword",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["NULL"] = "literal",
|
||||||
|
|
||||||
|
["attribute"] = "keyword",
|
||||||
|
["varying"] = "keyword",
|
||||||
|
["uniform"] = "keyword",
|
||||||
|
["buffer"] = "keyword",
|
||||||
|
["shared"] = "keyword",
|
||||||
|
["layout"] = "keyword",
|
||||||
|
["centroid"] = "keyword",
|
||||||
|
["flat"] = "keyword",
|
||||||
|
["smooth"] = "keyword",
|
||||||
|
["noperspective"]= "keyword",
|
||||||
|
["patch"] = "keyword",
|
||||||
|
["sample"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["out"] = "keyword",
|
||||||
|
["inout"] = "keyword",
|
||||||
|
["invariant"] = "keyword",
|
||||||
|
["precise"] = "keyword",
|
||||||
|
["lowp"] = "keyword",
|
||||||
|
["mediump"] = "keyword",
|
||||||
|
["highp"] = "keyword",
|
||||||
|
["precision"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["subroutine"] = "keyword",
|
||||||
|
|
||||||
|
["coherent"] = "keyword",
|
||||||
|
["volatile"] = "keyword",
|
||||||
|
["readonly"] = "keyword",
|
||||||
|
["writeonly"] = "keyword",
|
||||||
|
|
||||||
|
["sampler1D"] = "keyword2",
|
||||||
|
["sampler2D"] = "keyword2",
|
||||||
|
["sampler3D"] = "keyword2",
|
||||||
|
["samplerCube"] = "keyword2",
|
||||||
|
["sampler1DShadow"] = "keyword2",
|
||||||
|
["sampler2DShadow"] = "keyword2",
|
||||||
|
["samplerCubeShadow"] = "keyword2",
|
||||||
|
["sampler1DArray"] = "keyword2",
|
||||||
|
["sampler2DArray"] = "keyword2",
|
||||||
|
["samplerCubeArray"] = "keyword2",
|
||||||
|
["sampler1DArrayShadow"] = "keyword2",
|
||||||
|
["sampler2DArrayShadow"] = "keyword2",
|
||||||
|
["samplerCubeArrayShadow"]= "keyword2",
|
||||||
|
["isampler1D"] = "keyword2",
|
||||||
|
["isampler2D"] = "keyword2",
|
||||||
|
["isampler3D"] = "keyword2",
|
||||||
|
["isamplerCube"] = "keyword2",
|
||||||
|
["sampler2DMS"] = "keyword2",
|
||||||
|
["isampler2DMS"] = "keyword2",
|
||||||
|
["usampler2DMS"] = "keyword2",
|
||||||
|
["sampler2DMSArray"] = "keyword2",
|
||||||
|
["isampler2DMSArray"] = "keyword2",
|
||||||
|
["usampler2DMSArray"] = "keyword2",
|
||||||
|
["isampler1DArray"] = "keyword2",
|
||||||
|
["isampler2DArray"] = "keyword2",
|
||||||
|
["usampler1D"] = "keyword2",
|
||||||
|
["usampler2D"] = "keyword2",
|
||||||
|
["usampler3D"] = "keyword2",
|
||||||
|
["usamplerCube"] = "keyword2",
|
||||||
|
["usampler1DArray"] = "keyword2",
|
||||||
|
["usampler2DArray"] = "keyword2",
|
||||||
|
["sampler2DRect"] = "keyword2",
|
||||||
|
["sampler2DRectShadow"] = "keyword2",
|
||||||
|
["isampler2DRect"] = "keyword2",
|
||||||
|
["usampler2DRect"] = "keyword2",
|
||||||
|
["samplerBuffer"] = "keyword2",
|
||||||
|
["isamplerBuffer"] = "keyword2",
|
||||||
|
["usamplerBuffer"] = "keyword2",
|
||||||
|
|
||||||
|
["image1D"] = "keyword2",
|
||||||
|
["iimage1D"] = "keyword2",
|
||||||
|
["uimage1D"] = "keyword2",
|
||||||
|
["image1DArray"] = "keyword2",
|
||||||
|
["iimage1DArray"] = "keyword2",
|
||||||
|
["uimage1DArray"] = "keyword2",
|
||||||
|
["image2D"] = "keyword2",
|
||||||
|
["iimage2D"] = "keyword2",
|
||||||
|
["uimage2D"] = "keyword2",
|
||||||
|
["image2DArray"] = "keyword2",
|
||||||
|
["iimage2DArray"] = "keyword2",
|
||||||
|
["uimage2DArray"] = "keyword2",
|
||||||
|
["image2DRect"] = "keyword2",
|
||||||
|
["iimage2DRect"] = "keyword2",
|
||||||
|
["uimage2DRect"] = "keyword2",
|
||||||
|
["image2DMS"] = "keyword2",
|
||||||
|
["iimage2DMS"] = "keyword2",
|
||||||
|
["uimage2DMS"] = "keyword2",
|
||||||
|
["image2DMSArray"] = "keyword2",
|
||||||
|
["iimage2DMSArray"]= "keyword2",
|
||||||
|
["uimage2DMSArray"]= "keyword2",
|
||||||
|
["image3D"] = "keyword2",
|
||||||
|
["iimage3D"] = "keyword2",
|
||||||
|
["uimage3D"] = "keyword2",
|
||||||
|
["imageCube"] = "keyword2",
|
||||||
|
["iimageCube"] = "keyword2",
|
||||||
|
["uimageCube"] = "keyword2",
|
||||||
|
["imageCubeArray"] = "keyword2",
|
||||||
|
["iimageCubeArray"]= "keyword2",
|
||||||
|
["uimageCubeArray"]= "keyword2",
|
||||||
|
["imageBuffer"] = "keyword2",
|
||||||
|
["iimageBuffer"] = "keyword2",
|
||||||
|
["uimageBuffer"] = "keyword2",
|
||||||
|
|
||||||
|
["atomic_uint"] = "keyword2",
|
||||||
|
|
||||||
|
["radians"] = "keyword",
|
||||||
|
["degrees"] = "keyword",
|
||||||
|
["sin"] = "keyword",
|
||||||
|
["cos"] = "keyword",
|
||||||
|
["tan"] = "keyword",
|
||||||
|
["asin"] = "keyword",
|
||||||
|
["acos"] = "keyword",
|
||||||
|
["atan"] = "keyword",
|
||||||
|
["sinh"] = "keyword",
|
||||||
|
["cosh"] = "keyword",
|
||||||
|
["tanh"] = "keyword",
|
||||||
|
["asinh"] = "keyword",
|
||||||
|
["acosh"] = "keyword",
|
||||||
|
["pow"] = "keyword",
|
||||||
|
["exp"] = "keyword",
|
||||||
|
["exp2"] = "keyword",
|
||||||
|
["log2"] = "keyword",
|
||||||
|
["sqrt"] = "keyword",
|
||||||
|
["inversesqrt"] = "keyword",
|
||||||
|
["abs"] = "keyword",
|
||||||
|
["sign"] = "keyword",
|
||||||
|
["floor"] = "keyword",
|
||||||
|
["trunc"] = "keyword",
|
||||||
|
["round"] = "keyword",
|
||||||
|
["roundEven"] = "keyword",
|
||||||
|
["ceil"] = "keyword",
|
||||||
|
["fract"] = "keyword",
|
||||||
|
["mod"] = "keyword",
|
||||||
|
["modf"] = "keyword",
|
||||||
|
["min"] = "keyword",
|
||||||
|
["max"] = "keyword",
|
||||||
|
["clamp"] = "keyword",
|
||||||
|
["mix"] = "keyword",
|
||||||
|
["step"] = "keyword",
|
||||||
|
["smoothstep"] = "keyword",
|
||||||
|
["isnan"] = "keyword",
|
||||||
|
["isinf"] = "keyword",
|
||||||
|
["floatBitsToInt"] = "keyword",
|
||||||
|
["floatBitsToUint"] = "keyword",
|
||||||
|
["intBitsToFloat"] = "keyword",
|
||||||
|
["uintBitsToFloat"] = "keyword",
|
||||||
|
["fma"] = "keyword",
|
||||||
|
["frexp"] = "keyword",
|
||||||
|
["ldexp"] = "keyword",
|
||||||
|
["packUnorm2x16"] = "keyword",
|
||||||
|
["packSnorm2x16"] = "keyword",
|
||||||
|
["packUnorm4x8"] = "keyword",
|
||||||
|
["packSnorm4x8"] = "keyword",
|
||||||
|
["unpackUnorm2x16"] = "keyword",
|
||||||
|
["unpackSnorm2x16"] = "keyword",
|
||||||
|
["unpackUnorm4x8"] = "keyword",
|
||||||
|
["unpackSnorm4x8"] = "keyword",
|
||||||
|
["packHalf2x16"] = "keyword",
|
||||||
|
["unpackHalf2x16"] = "keyword",
|
||||||
|
["packDouble2x32"] = "keyword",
|
||||||
|
["unpackDouble2x32"] = "keyword",
|
||||||
|
["length"] = "keyword",
|
||||||
|
["distance"] = "keyword",
|
||||||
|
["dot"] = "keyword",
|
||||||
|
["cross"] = "keyword",
|
||||||
|
["normalize"] = "keyword",
|
||||||
|
["ftransform"] = "keyword",
|
||||||
|
["faceforward"] = "keyword",
|
||||||
|
["reflect"] = "keyword",
|
||||||
|
["refract"] = "keyword",
|
||||||
|
["matrixCompMult"] = "keyword",
|
||||||
|
["outerProduct"] = "keyword",
|
||||||
|
["transpose"] = "keyword",
|
||||||
|
["determinant"] = "keyword",
|
||||||
|
["inverse"] = "keyword",
|
||||||
|
["lessThan"] = "keyword",
|
||||||
|
["lessThanEqual"] = "keyword",
|
||||||
|
["greaterThan"] = "keyword",
|
||||||
|
["greaterThanEqual"] = "keyword",
|
||||||
|
["equal"] = "keyword",
|
||||||
|
["notEqual"] = "keyword",
|
||||||
|
["any"] = "keyword",
|
||||||
|
["all"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["uaddCarry"] = "keyword",
|
||||||
|
["usubBorrow"] = "keyword",
|
||||||
|
["umulExtended"] = "keyword",
|
||||||
|
["imulExtended"] = "keyword",
|
||||||
|
["bitfieldExtract"] = "keyword",
|
||||||
|
["bitfieldInsert"] = "keyword",
|
||||||
|
["bitfieldReverse"] = "keyword",
|
||||||
|
["bitCount"] = "keyword",
|
||||||
|
["findLSB"] = "keyword",
|
||||||
|
["findMSB"] = "keyword",
|
||||||
|
["textureSize"] = "keyword",
|
||||||
|
["textureQueryLod"] = "keyword",
|
||||||
|
["textureQueryLevels"] = "keyword",
|
||||||
|
["textureSamples"] = "keyword",
|
||||||
|
["texture"] = "keyword",
|
||||||
|
["textureProj"] = "keyword",
|
||||||
|
["textureLod"] = "keyword",
|
||||||
|
["textureOffset"] = "keyword",
|
||||||
|
["texelFetch"] = "keyword",
|
||||||
|
["texelFetchOffset"] = "keyword",
|
||||||
|
["textureProjOffset"] = "keyword",
|
||||||
|
["textureLodOffset"] = "keyword",
|
||||||
|
["textureProjLod"] = "keyword",
|
||||||
|
["textureProjLodOffset"] = "keyword",
|
||||||
|
["textureGrad"] = "keyword",
|
||||||
|
["textureGradOffset"] = "keyword",
|
||||||
|
["textureProjGrad"] = "keyword",
|
||||||
|
["textureProjGradOffset"]= "keyword",
|
||||||
|
["textureGather"] = "keyword",
|
||||||
|
["textureGatherOffset"] = "keyword",
|
||||||
|
["textureGatherOffsets"] = "keyword",
|
||||||
|
|
||||||
|
--Atomic Counter Functions
|
||||||
|
["atomicCounterIncrement"]= "keyword",
|
||||||
|
["atomicCounterDecrement"]= "keyword",
|
||||||
|
["atomicCounter"] = "keyword",
|
||||||
|
["atomicCounterAdd"] = "keyword",
|
||||||
|
["atomicCounterSubtract"] = "keyword",
|
||||||
|
["atomicCounterMin"] = "keyword",
|
||||||
|
["atomicCounterMax"] = "keyword",
|
||||||
|
["atomicCounterAnd"] = "keyword",
|
||||||
|
["atomicCounterOr"] = "keyword",
|
||||||
|
["atomicCounterXor"] = "keyword",
|
||||||
|
["atomicCounterExchange"] = "keyword",
|
||||||
|
["atomicCounterCompSwap"] = "keyword",
|
||||||
|
--Atomic Memory Functions
|
||||||
|
["atomicAdd"] = "keyword",
|
||||||
|
["atomicMin"] = "keyword",
|
||||||
|
["atomicMax"] = "keyword",
|
||||||
|
["atomicAnd"] = "keyword",
|
||||||
|
["atomicOr"] = "keyword",
|
||||||
|
["atomicXor"] = "keyword",
|
||||||
|
["atomicExchange"]= "keyword",
|
||||||
|
["atomicCompSwap"]= "keyword",
|
||||||
|
--Image Functions
|
||||||
|
["imageSize"] = "keyword",
|
||||||
|
["imageSamples"] = "keyword",
|
||||||
|
["imageLoad"] = "keyword",
|
||||||
|
["imageStore"] = "keyword",
|
||||||
|
["imageAtomicAdd"] = "keyword",
|
||||||
|
["imageAtomicMin"] = "keyword",
|
||||||
|
["imageAtomicMax"] = "keyword",
|
||||||
|
["imageAtomicAnd"] = "keyword",
|
||||||
|
["imageAtomicOr"] = "keyword",
|
||||||
|
["imageAtomicXor"] = "keyword",
|
||||||
|
["imageAtomicExchange"]= "keyword",
|
||||||
|
["imageAtomicCompSwap"]= "keyword",
|
||||||
|
--Geometry Shader Functions
|
||||||
|
["EmitStreamVertex"] = "keyword",
|
||||||
|
["EndStreamPrimitive"] = "keyword",
|
||||||
|
["EmitVertex"] = "keyword",
|
||||||
|
["EndPrimitive"] = "keyword",
|
||||||
|
--Fragment Processing Functions
|
||||||
|
["dFdx"] = "keyword",
|
||||||
|
["dFdy"] = "keyword",
|
||||||
|
["dFdxFine"] = "keyword",
|
||||||
|
["dFdyFine"] = "keyword",
|
||||||
|
["dFdxCoarse"] = "keyword",
|
||||||
|
["dFdyCoarse"] = "keyword",
|
||||||
|
["fwidth"] = "keyword",
|
||||||
|
["fwidthFine"] = "keyword",
|
||||||
|
["fwidthCoarse"] = "keyword",
|
||||||
|
["interpolateAtCentroid"]= "keyword",
|
||||||
|
["interpolateAtSample"] = "keyword",
|
||||||
|
["interpolateAtOffset"] = "keyword",
|
||||||
|
--Shader Invocation Control Functions
|
||||||
|
["barrier"] = "keyword",
|
||||||
|
--Shader Memory Control Functions
|
||||||
|
["memoryBarrier"] = "keyword",
|
||||||
|
["memoryBarrierAtomicCounter"]= "keyword",
|
||||||
|
["memoryBarrierBuffer"] = "keyword",
|
||||||
|
["memoryBarrierShared"] = "keyword",
|
||||||
|
["memoryBarrierImage"] = "keyword",
|
||||||
|
["groupMemoryBarrier"] = "keyword",
|
||||||
|
--Subpass-Input Functions
|
||||||
|
["subpassLoad"] = "keyword",
|
||||||
|
--Shader Invocation Group Functions
|
||||||
|
["anyInvocation"] = "keyword",
|
||||||
|
["allInvocations"] = "keyword",
|
||||||
|
["allInvocationsEqual"]= "keyword",
|
||||||
|
|
||||||
|
--"In addition, when targeting Vulkan, the following keywords also exist:"
|
||||||
|
["texture1D"] = "keyword",
|
||||||
|
["texture1DArray"] = "keyword",
|
||||||
|
["itexture1D"] = "keyword",
|
||||||
|
["itexture1DArray"] = "keyword",
|
||||||
|
["utexture1D"] = "keyword",
|
||||||
|
["utexture1DArray"] = "keyword",
|
||||||
|
["texture2D"] = "keyword",
|
||||||
|
["texture2DArray"] = "keyword",
|
||||||
|
["itexture2D"] = "keyword",
|
||||||
|
["itexture2DArray"] = "keyword",
|
||||||
|
["utexture2D"] = "keyword",
|
||||||
|
["utexture2DArray"] = "keyword",
|
||||||
|
["texture2DRect"] = "keyword",
|
||||||
|
["itexture2DRect"] = "keyword",
|
||||||
|
["utexture2DRect"] = "keyword",
|
||||||
|
["texture2DMS"] = "keyword",
|
||||||
|
["itexture2DMS"] = "keyword",
|
||||||
|
["utexture2DMS"] = "keyword",
|
||||||
|
["texture2DMSArray"] = "keyword",
|
||||||
|
["itexture2DMSArray"]= "keyword",
|
||||||
|
["utexture2DMSArray"]= "keyword",
|
||||||
|
["texture3D"] = "keyword",
|
||||||
|
["itexture3D"] = "keyword",
|
||||||
|
["utexture3D"] = "keyword",
|
||||||
|
["textureCube"] = "keyword",
|
||||||
|
["itextureCube"] = "keyword",
|
||||||
|
["utextureCube"] = "keyword",
|
||||||
|
["textureCubeArray"] = "keyword",
|
||||||
|
["itextureCubeArray"]= "keyword",
|
||||||
|
["utextureCubeArray"]= "keyword",
|
||||||
|
["textureBuffer"] = "keyword",
|
||||||
|
["itextureBuffer"] = "keyword",
|
||||||
|
["utextureBuffer"] = "keyword",
|
||||||
|
["sampler"] = "keyword2",
|
||||||
|
["samplerShadow"] = "keyword2",
|
||||||
|
["subpassInput"] = "keyword2",
|
||||||
|
["isubpassInput"] = "keyword2",
|
||||||
|
["usubpassInput"] = "keyword2",
|
||||||
|
["subpassInputMS"] = "keyword2",
|
||||||
|
["isubpassInputMS"] = "keyword2",
|
||||||
|
["usubpassInputMS"] = "keyword2",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
71
vendor/lite-plugins/plugins/language_go.lua
vendored
Normal file
71
vendor/lite-plugins/plugins/language_go.lua
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.go$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "`", "`", '\\' }, type = "string" },
|
||||||
|
{ pattern = "0[oO_][0-7]+", type = "number" },
|
||||||
|
{ pattern = "-?0x[%x_]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+_%d", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
|
||||||
|
{ pattern = ":=", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["if"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["elseif"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["package"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["func"] = "keyword",
|
||||||
|
["var"] = "keyword",
|
||||||
|
["type"] = "keyword",
|
||||||
|
["interface"] = "keyword",
|
||||||
|
["select"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["range"] = "keyword",
|
||||||
|
["chan"] = "keyword",
|
||||||
|
["defer"] = "keyword",
|
||||||
|
["go"] = "keyword",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["int64"] = "keyword2",
|
||||||
|
["int32"] = "keyword2",
|
||||||
|
["int16"] = "keyword2",
|
||||||
|
["int8"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["uint64"] = "keyword2",
|
||||||
|
["uint32"] = "keyword2",
|
||||||
|
["uint16"] = "keyword2",
|
||||||
|
["uint8"] = "keyword2",
|
||||||
|
["uintptr"] = "keyword2",
|
||||||
|
["float64"] = "keyword2",
|
||||||
|
["float32"] = "keyword2",
|
||||||
|
["map"] = "keyword2",
|
||||||
|
["string"] = "keyword2",
|
||||||
|
["rune"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["byte"] = "keyword2",
|
||||||
|
["error"] = "keyword2",
|
||||||
|
["complex64"] = "keyword2",
|
||||||
|
["complex128"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["nil"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
275
vendor/lite-plugins/plugins/language_hlsl.lua
vendored
Normal file
275
vendor/lite-plugins/plugins/language_hlsl.lua
vendored
Normal file
|
@ -0,0 +1,275 @@
|
||||||
|
|
||||||
|
local style = require "core.style"
|
||||||
|
local common = require "core.common"
|
||||||
|
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.hlsl$", },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "#", "[^\\]\n" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
|
||||||
|
|
||||||
|
{ pattern = "int[1-9]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "int1[0-6]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "int[1-9]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "int1[0-6]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "int[1-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "uint[1-9]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "uint1[0-6]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "uint[1-9]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "uint1[0-6]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "uint[1-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "dword[1-9]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "dword1[0-6]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "dword[1-9]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "dword1[0-6]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "dword[1-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "half[1-9]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "half1[0-6]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "half[1-9]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "half1[0-6]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "half[1-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "float[1-9]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "float1[0-6]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "float[1-9]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "float1[0-6]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "float[1-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "double[1-9]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "double1[0-6]x[1-9]", type = "keyword2" },
|
||||||
|
{ pattern = "double[1-9]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "double1[0-6]x1[0-6]", type = "keyword2" },
|
||||||
|
{ pattern = "double[1-4]", type = "keyword2" },
|
||||||
|
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-keywords
|
||||||
|
--The symbols are added in the order they appear on this webpage, which is alphabetically
|
||||||
|
["AppendStructuredBuffer"]= "keyword",
|
||||||
|
["asm"] = "keyword",
|
||||||
|
["asm_fragment"] = "keyword",
|
||||||
|
["BlendState"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["Buffer"] = "keyword2",
|
||||||
|
["ByteAddressBuffer"]= "keyword2",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["cbuffer"] = "keyword2",
|
||||||
|
["centroid"] = "keyword2",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["column_major"] = "keyword",
|
||||||
|
["compile"] = "keyword",
|
||||||
|
["compile_fragment"] = "keyword",
|
||||||
|
["CompileShader"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["ComputeShader"] = "keyword",
|
||||||
|
["ConsumeStructuredBuffer"]= "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["DepthStencilState"]= "keyword",
|
||||||
|
["DepthStencilView"] = "keyword",
|
||||||
|
["discard"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["DomainShader"] = "keyword2",
|
||||||
|
["dword"] = "keyword2",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["export"] = "keyword",
|
||||||
|
["extern"] = "keyword",
|
||||||
|
["false"] = "literal",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["fxgroup"] = "keyword2",
|
||||||
|
["GeometryShader"] = "keyword2",
|
||||||
|
["groupshared"] = "keyword",
|
||||||
|
["half"] = "keyword2",
|
||||||
|
["HullShader"] = "keyword2",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["inline"] = "keyword",
|
||||||
|
["inout"] = "keyword",
|
||||||
|
["InputPatch"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["interface"] = "keyword",
|
||||||
|
["line"] = "keyword2",
|
||||||
|
["lineadj"] = "keyword2",
|
||||||
|
["linear"] = "keyword",
|
||||||
|
["LineStream"] = "keyword2",
|
||||||
|
["matrix"] = "keyword2",
|
||||||
|
["min16float"] = "keyword2",
|
||||||
|
["min10float"] = "keyword2",
|
||||||
|
["min16int"] = "keyword2",
|
||||||
|
["min12int"] = "keyword2",
|
||||||
|
["min16uint"] = "keyword2",
|
||||||
|
["namespace"] = "keyword",
|
||||||
|
["nointerpolation"] = "keyword",
|
||||||
|
["noperspective"] = "keyword",
|
||||||
|
["NULL"] = "literal",
|
||||||
|
["out"] = "keyword",
|
||||||
|
["OutputPatch"] = "keyword2",
|
||||||
|
["packoffset"] = "keyword",
|
||||||
|
["pass"] = "keyword",
|
||||||
|
["pixelfragment"] = "keyword",
|
||||||
|
["PixelShader"] = "keyword2",
|
||||||
|
["point"] = "keyword2",
|
||||||
|
["PointStream"] = "keyword2",
|
||||||
|
["precise"] = "keyword",
|
||||||
|
["RasterizerState"] = "keyword2",
|
||||||
|
["RenderTargetView"] = "keyword2",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["register"] = "keyword",
|
||||||
|
["row_major"] = "keyword",
|
||||||
|
["RWBuffer"] = "keyword2",
|
||||||
|
["RWByteAddressBuffer"]= "keyword2",
|
||||||
|
["RWStructuredBuffer"]= "keyword2",
|
||||||
|
["RWTexture1D"] = "keyword2",
|
||||||
|
["RWTexture1DArray"] = "keyword2",
|
||||||
|
["RWTexture2D"] = "keyword2",
|
||||||
|
["RWTexture2DArray"] = "keyword2",
|
||||||
|
["RWTexture3D"] = "keyword2",
|
||||||
|
["sample"] = "keyword",
|
||||||
|
["sampler"] = "keyword2",
|
||||||
|
["SamplerState"] = "keyword2",
|
||||||
|
["SamplerComparisonState"]= "keyword2",
|
||||||
|
["shared"] = "keyword",
|
||||||
|
["snorm"] = "keyword",
|
||||||
|
["stateblock"] = "keyword",
|
||||||
|
["stateblock_state"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["string"] = "keyword2",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["StructuredBuffer"] = "keyword2",
|
||||||
|
["tbuffer"] = "keyword2",
|
||||||
|
["technique"] = "keyword2",
|
||||||
|
["technique10"] = "keyword2",
|
||||||
|
["technique11"] = "keyword2",
|
||||||
|
["texture"] = "keyword2",
|
||||||
|
["Texture1D"] = "keyword2",
|
||||||
|
["Texture1DArray"] = "keyword2",
|
||||||
|
["Texture2D"] = "keyword2",
|
||||||
|
["Texture2DArray"] = "keyword2",
|
||||||
|
["Texture2DMS"] = "keyword2",
|
||||||
|
["Texture2DMSArray"] = "keyword2",
|
||||||
|
["Texture3D"] = "keyword2",
|
||||||
|
["TextureCube"] = "keyword2",
|
||||||
|
["TextureCubeArray"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["typedef"] = "keyword",
|
||||||
|
["triangle"] = "keyword2",
|
||||||
|
["triangleadj"] = "keyword2",
|
||||||
|
["TriangleStream"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["uniform"] = "keyword",
|
||||||
|
["unorm"] = "keyword",
|
||||||
|
["unsigned"] = "keyword",
|
||||||
|
["vector"] = "keyword2",
|
||||||
|
["vertexfragment"] = "keyword2",
|
||||||
|
["VertexShader"] = "keyword2",
|
||||||
|
["void"] = "keyword",
|
||||||
|
["volatile"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
|
||||||
|
--https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-intrinsic-functions
|
||||||
|
--The symbols are added in the order they appear on this webpage, which is alphabetically
|
||||||
|
["abort"] = "keyword",
|
||||||
|
["abs"] = "keyword",
|
||||||
|
["acos"] = "keyword",
|
||||||
|
["all"] = "keyword",
|
||||||
|
["any"] = "keyword",
|
||||||
|
["asdouble"] = "keyword",
|
||||||
|
["asfloat"] = "keyword",
|
||||||
|
["asin"] = "keyword",
|
||||||
|
["asint"] = "keyword",
|
||||||
|
["asuint"] = "keyword",
|
||||||
|
["atan"] = "keyword",
|
||||||
|
["atan2"] = "keyword",
|
||||||
|
["ceil"] = "keyword",
|
||||||
|
["clamp"] = "keyword",
|
||||||
|
["clip"] = "keyword",
|
||||||
|
["cos"] = "keyword",
|
||||||
|
["cosh"] = "keyword",
|
||||||
|
["countbits"] = "keyword",
|
||||||
|
["cross"] = "keyword",
|
||||||
|
["ddx"] = "keyword",
|
||||||
|
["ddx_coarse"] = "keyword",
|
||||||
|
["ddx_fine"] = "keyword",
|
||||||
|
["ddy"] = "keyword",
|
||||||
|
["ddy_coarse"] = "keyword",
|
||||||
|
["ddy_fine"] = "keyword",
|
||||||
|
["degrees"] = "keyword",
|
||||||
|
["determinant"] = "keyword",
|
||||||
|
["distance"] = "keyword",
|
||||||
|
["dot"] = "keyword",
|
||||||
|
["dst"] = "keyword",
|
||||||
|
["errorf"] = "keyword",
|
||||||
|
["exp"] = "keyword",
|
||||||
|
["exp2"] = "keyword",
|
||||||
|
["f16tof32"] = "keyword",
|
||||||
|
["f32tof16"] = "keyword",
|
||||||
|
["faceforward"] = "keyword",
|
||||||
|
["firstbithigh"]= "keyword",
|
||||||
|
["firstbitlow"] = "keyword",
|
||||||
|
["floor"] = "keyword",
|
||||||
|
["fma"] = "keyword",
|
||||||
|
["fmod"] = "keyword",
|
||||||
|
["frac"] = "keyword",
|
||||||
|
["frexp"] = "keyword",
|
||||||
|
["fwidth"] = "keyword",
|
||||||
|
["isfinite"] = "keyword",
|
||||||
|
["isinf"] = "keyword",
|
||||||
|
["isnan"] = "keyword",
|
||||||
|
["ldexp"] = "keyword",
|
||||||
|
["length"] = "keyword",
|
||||||
|
["lerp"] = "keyword",
|
||||||
|
["lit"] = "keyword",
|
||||||
|
["log"] = "keyword",
|
||||||
|
["log10"] = "keyword",
|
||||||
|
["log2"] = "keyword",
|
||||||
|
["mad"] = "keyword",
|
||||||
|
["max"] = "keyword",
|
||||||
|
["min"] = "keyword",
|
||||||
|
["modf"] = "keyword",
|
||||||
|
["msad4"] = "keyword",
|
||||||
|
["mul"] = "keyword",
|
||||||
|
["noise"] = "keyword",
|
||||||
|
["normalize"] = "keyword",
|
||||||
|
["pow"] = "keyword",
|
||||||
|
["printf"] = "keyword",
|
||||||
|
["radians"] = "keyword",
|
||||||
|
["rcp"] = "keyword",
|
||||||
|
["reflect"] = "keyword",
|
||||||
|
["refract"] = "keyword",
|
||||||
|
["reversebits"] = "keyword",
|
||||||
|
["round"] = "keyword",
|
||||||
|
["rsqrt"] = "keyword",
|
||||||
|
["saturate"] = "keyword",
|
||||||
|
["sign"] = "keyword",
|
||||||
|
["sin"] = "keyword",
|
||||||
|
["sincos"] = "keyword",
|
||||||
|
["sinh"] = "keyword",
|
||||||
|
["smoothstep"] = "keyword",
|
||||||
|
["sqrt"] = "keyword",
|
||||||
|
["step"] = "keyword",
|
||||||
|
["tan"] = "keyword",
|
||||||
|
["tanh"] = "keyword",
|
||||||
|
["transpose"] = "keyword",
|
||||||
|
["trunc"] = "keyword",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
45
vendor/lite-plugins/plugins/language_hs.lua
vendored
Normal file
45
vendor/lite-plugins/plugins/language_hs.lua
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.hs$" },
|
||||||
|
comment = "%-%-",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = {"%-%-", "\n"}, type = "comment" },
|
||||||
|
{ pattern = { "{%-", "%-}" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*f?", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+f?", type = "number" },
|
||||||
|
{ pattern = "[!%#%$%%&*+./%<=>%?@\\%^|%-~:]", type = "operator" },
|
||||||
|
{ pattern = "[%a_'][%w_']*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["as"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["of"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["data"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["deriving"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["forall"] = "keyword",
|
||||||
|
["foreign"] = "keyword",
|
||||||
|
["hiding"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["infix"] = "keyword",
|
||||||
|
["infixl"] = "keyword",
|
||||||
|
["infixr"] = "keyword",
|
||||||
|
["let"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["mdo"] = "keyword",
|
||||||
|
["module"] = "keyword",
|
||||||
|
["newtype"] = "keyword",
|
||||||
|
["qualified"] = "keyword",
|
||||||
|
["type"] = "keyword",
|
||||||
|
["where"] = "keyword",
|
||||||
|
},
|
||||||
|
}
|
75
vendor/lite-plugins/plugins/language_java.lua
vendored
Normal file
75
vendor/lite-plugins/plugins/language_java.lua
vendored
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.java$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "'\\x%x?%x?%x?%x'", type = "string" }, -- character hexadecimal escape sequence
|
||||||
|
{ pattern = "'\\u%x%x%x%x'", type = "string" }, -- character unicode escape sequence
|
||||||
|
{ pattern = "'\\?.'", type = "string" }, -- character literal
|
||||||
|
{ pattern = "-?0x%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 = {
|
||||||
|
["if"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["else if"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["new"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["goto"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["implements"] = "keyword",
|
||||||
|
["extends"] = "keyword",
|
||||||
|
["private"] = "keyword",
|
||||||
|
["protected"] = "keyword",
|
||||||
|
["public"] = "keyword",
|
||||||
|
["abstract"] = "keyword",
|
||||||
|
["interface"] = "keyword",
|
||||||
|
["assert"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["native"] = "keyword",
|
||||||
|
["package"] = "keyword",
|
||||||
|
["super"] = "keyword",
|
||||||
|
["synchronized"] = "keyword",
|
||||||
|
["instanceof"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["throw"] = "keyword",
|
||||||
|
["throws"] = "keyword",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["transient"] = "keyword",
|
||||||
|
["finally"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["volatile"] = "keyword",
|
||||||
|
["final"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["void"] = "keyword",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["short"] = "keyword2",
|
||||||
|
["byte"] = "keyword2",
|
||||||
|
["long"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["char"] = "keyword2",
|
||||||
|
["boolean"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["null"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
91
vendor/lite-plugins/plugins/language_jiyu.lua
vendored
Normal file
91
vendor/lite-plugins/plugins/language_jiyu.lua
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.jiyu$", "%.jyu$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "\"\"\"", "\"\"\"" }, type = "string" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "0b[0-1]+", type = "number" },
|
||||||
|
{ pattern = "0x[%da-fA-F]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.]*", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+?", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
|
||||||
|
{ pattern = "[<>~=+-*/]=", type = "operator" },
|
||||||
|
{ pattern = "[..]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[#@]?[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
-- Keywords
|
||||||
|
["func"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["defer"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["fallthrough"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["union"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["using"] = "keyword",
|
||||||
|
["var"] = "keyword",
|
||||||
|
["let"] = "keyword",
|
||||||
|
["typealias"] = "keyword",
|
||||||
|
["library"] = "keyword",
|
||||||
|
["framework"] = "keyword",
|
||||||
|
["temporary_c_vararg"] = "keyword2";
|
||||||
|
-- Builtin procedures and directives
|
||||||
|
["cast"] = "keyword2",
|
||||||
|
["sizeof"] = "keyword2",
|
||||||
|
["alignof"] = "keyword2",
|
||||||
|
["strideof"] = "keyword2",
|
||||||
|
["offsetof"] = "keyword2",
|
||||||
|
["type_of"] = "keyword2",
|
||||||
|
["type_info"] = "keyword2",
|
||||||
|
["#if"] = "keyword2",
|
||||||
|
["#load"] = "keyword2",
|
||||||
|
["#import"] = "keyword2",
|
||||||
|
["#clang_import"] = "keyword2",
|
||||||
|
["#file"] = "keyword2",
|
||||||
|
["#filepath"] = "keyword2",
|
||||||
|
["#line"] = "keyword2",
|
||||||
|
|
||||||
|
["@c_function"] = "keyword2",
|
||||||
|
["@export"] = "keyword2",
|
||||||
|
["@flags"] = "keyword2",
|
||||||
|
["@metaprogram"] = "keyword2",
|
||||||
|
-- Types
|
||||||
|
["string"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["uint8"] = "keyword2",
|
||||||
|
["uint16"] = "keyword2",
|
||||||
|
["uint32"] = "keyword2",
|
||||||
|
["uint64"] = "keyword2",
|
||||||
|
["uint128"] = "keyword2",
|
||||||
|
["int8"] = "keyword2",
|
||||||
|
["int16"] = "keyword2",
|
||||||
|
["int32"] = "keyword2",
|
||||||
|
["int64"] = "keyword2",
|
||||||
|
["int128"] = "keyword2",
|
||||||
|
["float"] = "keyword2",
|
||||||
|
["double"] = "keyword2",
|
||||||
|
["void"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["Type"] = "keyword2",
|
||||||
|
|
||||||
|
-- Literals
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["null"] = "literal",
|
||||||
|
}
|
||||||
|
}
|
17
vendor/lite-plugins/plugins/language_make.lua
vendored
Normal file
17
vendor/lite-plugins/plugins/language_make.lua
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "Makefile", "makefile", "%.mk$" },
|
||||||
|
comment = "#",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "#.*\n", type = "comment" },
|
||||||
|
{ pattern = [[\.]], type = "normal" },
|
||||||
|
{ pattern = "$[@^<%%?+|*]", type = "keyword2" },
|
||||||
|
{ pattern = "$%(.-%)", type = "variable" },
|
||||||
|
{ pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
|
||||||
|
{ pattern = "%..*:", type = "keyword2" },
|
||||||
|
{ pattern = ".*:", type = "function" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
},
|
||||||
|
}
|
35
vendor/lite-plugins/plugins/language_meson.lua
vendored
Normal file
35
vendor/lite-plugins/plugins/language_meson.lua
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = "meson.build$",
|
||||||
|
comment = "#",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = { "#", "\n" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'''", "'''" }, type = "string" },
|
||||||
|
{ pattern = "0x[%da-fA-F]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+%d*", type = "number" },
|
||||||
|
{ pattern = "[%+%-=/%%%*!]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["if"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["elif"] = "keyword",
|
||||||
|
["endif"] = "keyword",
|
||||||
|
["foreach"] = "keyword",
|
||||||
|
["endforeach"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["and"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["or"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
157
vendor/lite-plugins/plugins/language_odin.lua
vendored
Normal file
157
vendor/lite-plugins/plugins/language_odin.lua
vendored
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = "%.odin$",
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = { "`", "`" }, type = "string" },
|
||||||
|
{ pattern = "0b[01_]+", type = "number" },
|
||||||
|
{ pattern = "0o[0-7_]+", type = "number" },
|
||||||
|
{ pattern = "0[dz][%d_]+", type = "number" },
|
||||||
|
{ pattern = "0x[%da-fA-F_]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%._e]*i?", type = "number" },
|
||||||
|
{ pattern = "-?%.?[%d_]+i?", type = "number" },
|
||||||
|
{ pattern = "[<>~=+-*/]=", type = "operator" },
|
||||||
|
{ pattern = "[::][:=]", type = "operator" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&:]", type = "operator" },
|
||||||
|
{ pattern = "%$[%a_][%w_]*", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
|
||||||
|
{ pattern = "[#@]?[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
-- Keywords
|
||||||
|
["package"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["foreign"] = "keyword",
|
||||||
|
["when"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["defer"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["case"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["notin"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["fallthrough"] = "keyword",
|
||||||
|
["proc"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["union"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["bit_set"] = "keyword",
|
||||||
|
["map"] = "keyword",
|
||||||
|
["dynamic"] = "keyword",
|
||||||
|
["using"] = "keyword",
|
||||||
|
["inline"] = "keyword",
|
||||||
|
["no_inline"] = "keyword",
|
||||||
|
["context"] = "keyword",
|
||||||
|
["distinct"] = "keyword",
|
||||||
|
["opaque"] = "keyword",
|
||||||
|
["macro"] = "keyword", -- Reserved, not yet used
|
||||||
|
["const"] = "keyword", -- Reserved, not yet used
|
||||||
|
-- Builtin procedures and directives
|
||||||
|
["cast"] = "keyword2",
|
||||||
|
["auto_cast"] = "keyword2",
|
||||||
|
["transmute"] = "keyword2",
|
||||||
|
["len"] = "keyword2",
|
||||||
|
["cap"] = "keyword2",
|
||||||
|
["size_of"] = "keyword2",
|
||||||
|
["align_of"] = "keyword2",
|
||||||
|
["offset_of"] = "keyword2",
|
||||||
|
["typeid_of"] = "keyword2",
|
||||||
|
["type_of"] = "keyword2",
|
||||||
|
["type_info_of"] = "keyword2",
|
||||||
|
["type_info_base"] = "keyword2",
|
||||||
|
["swizzle"] = "keyword2",
|
||||||
|
["complex"] = "keyword2",
|
||||||
|
["real"] = "keyword2",
|
||||||
|
["imag"] = "keyword2",
|
||||||
|
["conj"] = "keyword2",
|
||||||
|
["min"] = "keyword2",
|
||||||
|
["max"] = "keyword2",
|
||||||
|
["abs"] = "keyword2",
|
||||||
|
["clamp"] = "keyword2",
|
||||||
|
["assert"] = "keyword2",
|
||||||
|
["#assert"] = "keyword2",
|
||||||
|
["#location"] = "keyword2",
|
||||||
|
["#caller_location"] = "keyword2",
|
||||||
|
["#packed"] = "keyword2",
|
||||||
|
["#raw_union"] = "keyword2",
|
||||||
|
["#align"] = "keyword2",
|
||||||
|
["#no_nil"] = "keyword2",
|
||||||
|
["#complete"] = "keyword2",
|
||||||
|
["#no_alias"] = "keyword2",
|
||||||
|
["#align"] = "keyword2",
|
||||||
|
["#load"] = "keyword2",
|
||||||
|
["#location"] = "keyword2",
|
||||||
|
["#file"] = "keyword2",
|
||||||
|
["#line"] = "keyword2",
|
||||||
|
["#procedure"] = "keyword2",
|
||||||
|
["#defined"] = "keyword2",
|
||||||
|
["#no_bounds_check"] = "keyword2",
|
||||||
|
["#bounds_check"] = "keyword2",
|
||||||
|
["#type"] = "keyword2",
|
||||||
|
["@private"] = "keyword2",
|
||||||
|
-- Types
|
||||||
|
["rawptr"] = "keyword2",
|
||||||
|
["typeid"] = "keyword2",
|
||||||
|
["any"] = "keyword2",
|
||||||
|
["string"] = "keyword2",
|
||||||
|
["cstring"] = "keyword2",
|
||||||
|
["int"] = "keyword2",
|
||||||
|
["uint"] = "keyword2",
|
||||||
|
["uintptr"] = "keyword2",
|
||||||
|
["rune"] = "keyword2",
|
||||||
|
["byte"] = "keyword2",
|
||||||
|
["u8"] = "keyword2",
|
||||||
|
["u16"] = "keyword2",
|
||||||
|
["u32"] = "keyword2",
|
||||||
|
["u64"] = "keyword2",
|
||||||
|
["u128"] = "keyword2",
|
||||||
|
["i8"] = "keyword2",
|
||||||
|
["i16"] = "keyword2",
|
||||||
|
["i32"] = "keyword2",
|
||||||
|
["i64"] = "keyword2",
|
||||||
|
["i128"] = "keyword2",
|
||||||
|
["f16"] = "keyword2",
|
||||||
|
["f32"] = "keyword2",
|
||||||
|
["f64"] = "keyword2",
|
||||||
|
["u16le"] = "keyword2",
|
||||||
|
["u32le"] = "keyword2",
|
||||||
|
["u64le"] = "keyword2",
|
||||||
|
["u128le"] = "keyword2",
|
||||||
|
["i16le"] = "keyword2",
|
||||||
|
["i32le"] = "keyword2",
|
||||||
|
["i64le"] = "keyword2",
|
||||||
|
["i128le"] = "keyword2",
|
||||||
|
["u16be"] = "keyword2",
|
||||||
|
["u32be"] = "keyword2",
|
||||||
|
["u64be"] = "keyword2",
|
||||||
|
["u128be"] = "keyword2",
|
||||||
|
["i16be"] = "keyword2",
|
||||||
|
["i32be"] = "keyword2",
|
||||||
|
["i64be"] = "keyword2",
|
||||||
|
["i128be"] = "keyword2",
|
||||||
|
["complex32"] = "keyword2",
|
||||||
|
["complex64"] = "keyword2",
|
||||||
|
["complex128"] = "keyword2",
|
||||||
|
["quaternion128"] = "keyword2",
|
||||||
|
["quaternion256"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["b8"] = "keyword2",
|
||||||
|
["b32"] = "keyword2",
|
||||||
|
["b64"] = "keyword2",
|
||||||
|
["b128"] = "keyword2",
|
||||||
|
-- Literals
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["nil"] = "literal",
|
||||||
|
}
|
||||||
|
}
|
99
vendor/lite-plugins/plugins/language_php.lua
vendored
Normal file
99
vendor/lite-plugins/plugins/language_php.lua
vendored
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
}
|
51
vendor/lite-plugins/plugins/language_pico8.lua
vendored
Normal file
51
vendor/lite-plugins/plugins/language_pico8.lua
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = "%.p8$",
|
||||||
|
headers = "^pico-8 cartridge",
|
||||||
|
comment = "--",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = { 'pico%-8 cartridge', '__lua__' }, type = "comment" },
|
||||||
|
{ pattern = { '__gfx__\n', '%z' }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = { "%[%[", "%]%]" }, type = "string" },
|
||||||
|
{ pattern = { "%-%-%[%[", "%]%]"}, type = "comment" },
|
||||||
|
{ pattern = "%-%-.-\n", type = "comment" },
|
||||||
|
{ pattern = "-?0x%x+", type = "number" },
|
||||||
|
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
|
||||||
|
{ pattern = "-?%.?%d+", type = "number" },
|
||||||
|
{ pattern = "%.%.%.?", type = "operator" },
|
||||||
|
{ pattern = "[<>~=&|]=", type = "operator" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%#<>]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
{ pattern = "::[%a_][%w_]*::", type = "function" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["if"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["elseif"] = "keyword",
|
||||||
|
["end"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["function"] = "keyword",
|
||||||
|
["repeat"] = "keyword",
|
||||||
|
["until"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["local"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["not"] = "keyword",
|
||||||
|
["and"] = "keyword",
|
||||||
|
["or"] = "keyword",
|
||||||
|
["goto"] = "keyword",
|
||||||
|
["self"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["nil"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
72
vendor/lite-plugins/plugins/language_powershell.lua
vendored
Normal file
72
vendor/lite-plugins/plugins/language_powershell.lua
vendored
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = {"%.ps1$", "%.psm1$", "%.psd1$", "%.ps1xml$", "%.pssc$", "%.psrc$", "%.cdxml$"},
|
||||||
|
comment = "#",
|
||||||
|
patterns = {
|
||||||
|
{pattern = "#.*\n", type = "comment"},
|
||||||
|
{pattern = [[\.]], type = "normal"},
|
||||||
|
{pattern = {'"', '"'}, type = "string"},
|
||||||
|
{pattern = {"'", "'"}, type = "string"},
|
||||||
|
{pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number"},
|
||||||
|
{pattern = "[%+=/%*%^%%<>!~|&,:]+", type = "operator"},
|
||||||
|
{pattern = "%f[%S]%-[%w%-_]+", type = "function"},
|
||||||
|
{pattern = "[%u][%a]+[%-][%u][%a]+", type = "function"},
|
||||||
|
{pattern = "${.*}", type = "symbol"},
|
||||||
|
{pattern = "$[%a_@*][%w_]*", type = "keyword2"},
|
||||||
|
{pattern = "$[%$][%a]+", type = "keyword2"},
|
||||||
|
{pattern = "[%a_][%w_]*", type = "symbol"}
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["if"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["elseif"] = "keyword",
|
||||||
|
["switch"] = "keyword",
|
||||||
|
["default"] = "keyword",
|
||||||
|
["function"] = "keyword",
|
||||||
|
["filter"] = "keyword",
|
||||||
|
["workflow"] = "keyword",
|
||||||
|
["configuration"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["Parameter"] = "keyword",
|
||||||
|
["ValidateScript"] = "keyword",
|
||||||
|
["CmdletBinding"] = "keyword",
|
||||||
|
["try"] = "keyword",
|
||||||
|
["catch"] = "keyword",
|
||||||
|
["finally"] = "keyword",
|
||||||
|
["throw"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["until"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["foreach"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["where"] = "function",
|
||||||
|
["select"] = "function",
|
||||||
|
["filter"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["trap"] = "keyword",
|
||||||
|
["param"] = "keyword",
|
||||||
|
["data"] = "keyword",
|
||||||
|
["dynamicparam"] = "keyword",
|
||||||
|
["begin"] = "function",
|
||||||
|
["process"] = "function",
|
||||||
|
["end"] = "function",
|
||||||
|
["exit"] = "function",
|
||||||
|
["inlinescript"] = "function",
|
||||||
|
["parallel"] = "function",
|
||||||
|
["sequence"] = "function",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["TODO"] = "comment",
|
||||||
|
["FIXME"] = "comment",
|
||||||
|
["XXX"] = "comment",
|
||||||
|
["TBD"] = "comment",
|
||||||
|
["HACK"] = "comment",
|
||||||
|
["NOTE"] = "comment"
|
||||||
|
}
|
||||||
|
}
|
90
vendor/lite-plugins/plugins/language_psql.lua
vendored
Normal file
90
vendor/lite-plugins/plugins/language_psql.lua
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
-- In sql symbols can be lower case and upper case
|
||||||
|
local keywords = {
|
||||||
|
"CREATE", "SELECT", "INSERT", "INTO", "UPDATE",
|
||||||
|
"DELETE", "TABLE", "DROP", "VALUES", "NOT",
|
||||||
|
"NULL", "PRIMARY", "KEY", "REFERENCES",
|
||||||
|
"DEFAULT", "UNIQUE", "CONSTRAINT", "CHECK",
|
||||||
|
"ON", "EXCLUDE", "WITH", "USING", "WHERE",
|
||||||
|
"GROUP", "BY", "HAVING", "DISTINCT", "LIMIT",
|
||||||
|
"OFFSET", "ONLY", "CROSS", "JOIN", "INNER",
|
||||||
|
"LEFT", "RIGHT", "FULL", "OUTER", "NATURAL",
|
||||||
|
"AND", "OR", "AS", "ORDER", "ORDINALITY",
|
||||||
|
"UNNEST", "FROM", "VIEW", "RETURNS", "SETOF",
|
||||||
|
"LANGUAGE", "SQL", "LIKE", "LATERAL",
|
||||||
|
"INTERVAL", "PARTITION", "UNION", "INTERSECT",
|
||||||
|
"EXCEPT", "ALL", "ASC", "DESC", "NULLS",
|
||||||
|
"FIRST", "LAST", "IN", "RECURSIVE", "ARRAY",
|
||||||
|
"RETURNING", "SET", "ALSO", "INSTEAD",
|
||||||
|
"ALTER", "SEQUENCE", "OWNED", "AT", "ZONE",
|
||||||
|
"WITHOUT", "TO", "TIMEZONE", "TYPE", "ENUM",
|
||||||
|
"DOCUMENT", "XMLPARSE", "XMLSERIALIZE",
|
||||||
|
"CONTENT", "OPTION", "INDEX", "ANY",
|
||||||
|
"EXTENSION", "ISNULL", "NOTNULL", "UNKNOWN",
|
||||||
|
"CASE", "THEN", "WHEN", "ELSE", "END",
|
||||||
|
"ROWS", "BETWEEN", "UNBOUNDED", "PRECEDING",
|
||||||
|
"UNBOUNDED", "FOLLOWING", "EXISTS", "SOME",
|
||||||
|
"COLLATION", "FOR", "TRIGGER", "BEFORE",
|
||||||
|
"EACH", "ROW", "EXECUTE", "PROCEDURE",
|
||||||
|
"FUNCTION", "DECLARE", "BEGIN", "LOOP",
|
||||||
|
"RAISE", "NOTICE", "LOOP", "EVENT",
|
||||||
|
"OPERATOR", "DOMAIN", "VARIADIC", "FOREIGN"
|
||||||
|
}
|
||||||
|
|
||||||
|
local types = {
|
||||||
|
"BIGINT", "INT8", "BIGSERIAL", "SERIAL8",
|
||||||
|
"BIT", "VARBIT", "BOOLEAN", "BOOL", "BOX",
|
||||||
|
"BYTEA", "CHARACTER", "CHAR", "VARCHAR",
|
||||||
|
"CIDR", "CIRCLE", "DATE", "DOUBLE",
|
||||||
|
"PRECISION", "FLOAT8", "INET", "INTEGER",
|
||||||
|
"INT", "INT4", "INTERVAL", "JSON", "JSONB",
|
||||||
|
"LINE", "LSEG", "MACADDR", "MONEY", "NUMERIC",
|
||||||
|
"DECIMAL", "PATH", "POINT", "POLYGON", "REAL",
|
||||||
|
"FLOAT4", "INT2", "SMALLINT", "SMALLSERIAL",
|
||||||
|
"SERIAL2", "SERIAL", "SERIAL4", "TEXT",
|
||||||
|
"TIME", "TIMEZ", "TIMESTAMP", "TIMESTAMPZ",
|
||||||
|
"TSQUERY", "TSVECTOR", "TXID_SNAPSHOT",
|
||||||
|
"UUID", "XML", "INT4RANGE", "INT8RANGE",
|
||||||
|
"NUMRANGE", "TSRANGE", "TSTZRANGE",
|
||||||
|
"DATERANGE", "PG_LSN"
|
||||||
|
}
|
||||||
|
|
||||||
|
local literals = {
|
||||||
|
"FALSE", "TRUE", "CURRENT_TIMESTAMP",
|
||||||
|
"CURRENT_TIME", "CURRENT_DATE", "LOCALTIME",
|
||||||
|
"LOCALTIMESTAMP"
|
||||||
|
}
|
||||||
|
|
||||||
|
local symbols = {}
|
||||||
|
for _, keyword in ipairs(keywords) do
|
||||||
|
symbols[keyword:lower()] = "keyword"
|
||||||
|
symbols[keyword] = "keyword"
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, type in ipairs(types) do
|
||||||
|
symbols[type:lower()] = "keyword2"
|
||||||
|
symbols[type] = "keyword2"
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, literal in ipairs(literals) do
|
||||||
|
symbols[literal:lower()] = "literal"
|
||||||
|
symbols[literal] = "literal"
|
||||||
|
end
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.sql$", "%.psql$" },
|
||||||
|
comment = "--",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "%-%-.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ 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 = symbols,
|
||||||
|
}
|
||||||
|
|
84
vendor/lite-plugins/plugins/language_rust.lua
vendored
Normal file
84
vendor/lite-plugins/plugins/language_rust.lua
vendored
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.rs$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "`", "`", '\\' }, type = "string" },
|
||||||
|
{ pattern = "0[oO_][0-7]+", type = "number" },
|
||||||
|
{ pattern = "-?0x[%x_]+", type = "number" },
|
||||||
|
{ pattern = "-?%d+_%d", 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 = {
|
||||||
|
["as"] = "keyword",
|
||||||
|
["async"] = "keyword",
|
||||||
|
["await"] = "keyword",
|
||||||
|
["break"] = "keyword",
|
||||||
|
["const"] = "keyword",
|
||||||
|
["continue"] = "keyword",
|
||||||
|
["crate"] = "keyword",
|
||||||
|
["dyn"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["enum"] = "keyword",
|
||||||
|
["extern"] = "keyword",
|
||||||
|
["false"] = "keyword",
|
||||||
|
["fn"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["impl"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["let"] = "keyword",
|
||||||
|
["loop"] = "keyword",
|
||||||
|
["match"] = "keyword",
|
||||||
|
["mod"] = "keyword",
|
||||||
|
["move"] = "keyword",
|
||||||
|
["mut"] = "keyword",
|
||||||
|
["pub"] = "keyword",
|
||||||
|
["ref"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["Self"] = "keyword",
|
||||||
|
["self"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["struct"] = "keyword",
|
||||||
|
["super"] = "keyword",
|
||||||
|
["trait"] = "keyword",
|
||||||
|
["true"] = "keyword",
|
||||||
|
["type"] = "keyword",
|
||||||
|
["unsafe"] = "keyword",
|
||||||
|
["use"] = "keyword",
|
||||||
|
["where"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["i32"] = "keyword2",
|
||||||
|
["i64"] = "keyword2",
|
||||||
|
["i128"] = "keyword2",
|
||||||
|
["i16"] = "keyword2",
|
||||||
|
["i8"] = "keyword2",
|
||||||
|
["u16"] = "keyword2",
|
||||||
|
["u32"] = "keyword2",
|
||||||
|
["u64"] = "keyword2",
|
||||||
|
["usize"] = "keyword2",
|
||||||
|
["isize"] = "keyword2",
|
||||||
|
["f32"] = "keyword2",
|
||||||
|
["f64"] = "keyword2",
|
||||||
|
["f128"] = "keyword2",
|
||||||
|
["String"] = "keyword2",
|
||||||
|
["&str"] = "keyword2",
|
||||||
|
["bool"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["None"] = "literal",
|
||||||
|
["Some"] = "literal",
|
||||||
|
["Option"] = "literal",
|
||||||
|
["Result"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
42
vendor/lite-plugins/plugins/language_sh.lua
vendored
Normal file
42
vendor/lite-plugins/plugins/language_sh.lua
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.sh$" },
|
||||||
|
headers = "^#!.*bin.*sh\n",
|
||||||
|
comment = "#",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "#.*\n", type = "comment" },
|
||||||
|
{ pattern = [[\.]], type = "normal" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = { '`', '`', '\\' }, type = "string" },
|
||||||
|
{ pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number" },
|
||||||
|
{ pattern = "[!<>|&%[%]=*]", type = "operator" },
|
||||||
|
{ pattern = "%f[%S]%-[%w%-_]+", type = "function" },
|
||||||
|
{ pattern = "${.*}", type = "keyword2" },
|
||||||
|
{ pattern = "$[%a_@*][%w_]*", type = "keyword2" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["case"] = "keyword",
|
||||||
|
["do"] = "keyword",
|
||||||
|
["done"] = "keyword",
|
||||||
|
["elif"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["esac"] = "keyword",
|
||||||
|
["fi"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["function"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["select"] = "keyword",
|
||||||
|
["then"] = "keyword",
|
||||||
|
["time"] = "keyword",
|
||||||
|
["until"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["echo"] = "keyword",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
16
vendor/lite-plugins/plugins/language_tex.lua
vendored
Normal file
16
vendor/lite-plugins/plugins/language_tex.lua
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.tex$" },
|
||||||
|
comment = "%%",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = {"%%", "\n"}, type = "comment" },
|
||||||
|
{ pattern = "&", type = "operator" },
|
||||||
|
{ pattern = "\\\\", type = "operator" },
|
||||||
|
{ pattern = {"%$", "%$"}, type = "operator" },
|
||||||
|
{ pattern = {"\\%[", "\\]"}, type = "operator" },
|
||||||
|
{ pattern = {"{", "}"}, type = "keyword" },
|
||||||
|
{ pattern = "\\%w*", type = "keyword2" },
|
||||||
|
},
|
||||||
|
symbols = {}
|
||||||
|
}
|
43
vendor/lite-plugins/plugins/language_wren.lua
vendored
Normal file
43
vendor/lite-plugins/plugins/language_wren.lua
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
|
syntax.add {
|
||||||
|
files = { "%.wren$" },
|
||||||
|
comment = "//",
|
||||||
|
patterns = {
|
||||||
|
{ pattern = "//.-\n", type = "comment" },
|
||||||
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = "-?%.?%d+", type = "number" },
|
||||||
|
{ pattern = "%.%.%.?", type = "operator" },
|
||||||
|
{ pattern = "[<>!=]=", type = "operator" },
|
||||||
|
{ pattern = "[%+%-=/%*%^%%<>!~|&?:]", type = "operator" },
|
||||||
|
{ pattern = "[%a_][%w_]*%s*%f[(\"{]", type = "function" },
|
||||||
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
|
},
|
||||||
|
symbols = {
|
||||||
|
["break"] = "keyword",
|
||||||
|
["class"] = "keyword",
|
||||||
|
["construct"] = "keyword",
|
||||||
|
["else"] = "keyword",
|
||||||
|
["false"] = "keyword",
|
||||||
|
["for"] = "keyword",
|
||||||
|
["foreign"] = "keyword",
|
||||||
|
["if"] = "keyword",
|
||||||
|
["import"] = "keyword",
|
||||||
|
["in"] = "keyword",
|
||||||
|
["is"] = "keyword",
|
||||||
|
["null"] = "keyword",
|
||||||
|
["return"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
|
["super"] = "keyword",
|
||||||
|
["this"] = "keyword",
|
||||||
|
["true"] = "keyword",
|
||||||
|
["var"] = "keyword",
|
||||||
|
["while"] = "keyword",
|
||||||
|
["this"] = "keyword2",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["null"] = "literal",
|
||||||
|
},
|
||||||
|
}
|
26
vendor/lite-plugins/plugins/lastproject.lua
vendored
Normal file
26
vendor/lite-plugins/plugins/lastproject.lua
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
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")
|
||||||
|
fp:write(system.absolute_path ".")
|
||||||
|
fp:close()
|
||||||
|
|
||||||
|
|
||||||
|
-- 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
|
64
vendor/lite-plugins/plugins/lfautoinsert.lua
vendored
Normal file
64
vendor/lite-plugins/plugins/lfautoinsert.lua
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local config = require "core.config"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
config.lfautoinsert_map = {
|
||||||
|
["{%s*\n"] = "}",
|
||||||
|
["%(%s*\n"] = ")",
|
||||||
|
["%f[[]%[%s*\n"] = "]",
|
||||||
|
["%[%[%s*\n"] = "]]",
|
||||||
|
["=%s*\n"] = false,
|
||||||
|
[":%s*\n"] = false,
|
||||||
|
["^#if.*\n"] = "#endif",
|
||||||
|
["^#else.*\n"] = "#endif",
|
||||||
|
["%f[%w]do%s*\n"] = "end",
|
||||||
|
["%f[%w]then%s*\n"] = "end",
|
||||||
|
["%f[%w]else%s*\n"] = "end",
|
||||||
|
["%f[%w]repeat%s*\n"] = "until",
|
||||||
|
["%f[%w]function.*%)%s*\n"] = "end",
|
||||||
|
["^%s*<([^/][^%s>]*)[^>]*>%s*\n"] = "</$TEXT>",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local function indent_size(doc, line)
|
||||||
|
local text = doc.lines[line] or ""
|
||||||
|
local s, e = text:find("^[\t ]*")
|
||||||
|
return e - s
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["autoinsert:newline"] = function()
|
||||||
|
command.perform("doc:newline")
|
||||||
|
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local line, col = doc:get_selection()
|
||||||
|
local text = doc.lines[line - 1]
|
||||||
|
|
||||||
|
for ptn, close in pairs(config.lfautoinsert_map) do
|
||||||
|
local s, _, str = text:find(ptn)
|
||||||
|
if s then
|
||||||
|
if close
|
||||||
|
and col == #doc.lines[line]
|
||||||
|
and indent_size(doc, line + 1) <= indent_size(doc, line - 1)
|
||||||
|
then
|
||||||
|
close = str and close:gsub("$TEXT", str) or close
|
||||||
|
command.perform("doc:newline")
|
||||||
|
core.active_view:on_text_input(close)
|
||||||
|
command.perform("doc:move-to-previous-line")
|
||||||
|
if doc.lines[line+1] == doc.lines[line+2] then
|
||||||
|
doc:remove(line+1, 1, line+2, 1)
|
||||||
|
end
|
||||||
|
elseif col < #doc.lines[line] then
|
||||||
|
command.perform("doc:newline")
|
||||||
|
command.perform("doc:move-to-previous-line")
|
||||||
|
end
|
||||||
|
command.perform("doc:indent")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["return"] = { "command:submit", "autoinsert:newline" }
|
||||||
|
}
|
45
vendor/lite-plugins/plugins/linecopypaste.lua
vendored
Executable file
45
vendor/lite-plugins/plugins/linecopypaste.lua
vendored
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
|
||||||
|
local function doc()
|
||||||
|
return core.active_view.doc
|
||||||
|
end
|
||||||
|
|
||||||
|
local line_in_clipboard = false
|
||||||
|
|
||||||
|
local doc_copy = command.map["doc:copy"].perform
|
||||||
|
command.map["doc:copy"].perform = function()
|
||||||
|
if doc():has_selection() then
|
||||||
|
doc_copy()
|
||||||
|
line_in_clipboard = false
|
||||||
|
else
|
||||||
|
local line = doc():get_selection()
|
||||||
|
system.set_clipboard(doc().lines[line])
|
||||||
|
line_in_clipboard = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local doc_cut = command.map["doc:cut"].perform
|
||||||
|
command.map["doc:cut"].perform = function()
|
||||||
|
if doc():has_selection() then
|
||||||
|
doc_cut()
|
||||||
|
line_in_clipboard = false
|
||||||
|
else
|
||||||
|
local line = doc():get_selection()
|
||||||
|
system.set_clipboard(doc().lines[line])
|
||||||
|
doc():remove(line, 1, line+1, 1)
|
||||||
|
doc():set_selection(line, 1)
|
||||||
|
line_in_clipboard = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local doc_paste = command.map["doc:paste"].perform
|
||||||
|
command.map["doc:paste"].perform = function()
|
||||||
|
if line_in_clipboard == false then
|
||||||
|
doc_paste()
|
||||||
|
else
|
||||||
|
local line, col = doc():get_selection()
|
||||||
|
doc():insert(line, 1, system.get_clipboard():gsub("\r", ""))
|
||||||
|
doc():set_selection(line+1, col)
|
||||||
|
end
|
||||||
|
end
|
18
vendor/lite-plugins/plugins/lineguide.lua
vendored
Normal file
18
vendor/lite-plugins/plugins/lineguide.lua
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local config = require "core.config"
|
||||||
|
local style = require "core.style"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
local draw = DocView.draw
|
||||||
|
|
||||||
|
function DocView:draw(...)
|
||||||
|
draw(self, ...)
|
||||||
|
|
||||||
|
local offset = self:get_font():get_width("n") * config.line_limit
|
||||||
|
local x = self:get_line_screen_position(1) + offset
|
||||||
|
local y = self.position.y
|
||||||
|
local w = math.ceil(SCALE * 1)
|
||||||
|
local h = self.size.y
|
||||||
|
|
||||||
|
local color = style.guide or style.selection
|
||||||
|
renderer.draw_rect(x, y, w, h, color)
|
||||||
|
end
|
18
vendor/lite-plugins/plugins/macmodkeys.lua
vendored
Normal file
18
vendor/lite-plugins/plugins/macmodkeys.lua
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
local on_key_pressed = keymap.on_key_pressed
|
||||||
|
local on_key_released = keymap.on_key_released
|
||||||
|
|
||||||
|
local function remap_key(k)
|
||||||
|
return k:gsub("command", "ctrl")
|
||||||
|
:gsub("option", "alt")
|
||||||
|
end
|
||||||
|
|
||||||
|
function keymap.on_key_pressed(k)
|
||||||
|
return on_key_pressed(remap_key(k))
|
||||||
|
end
|
||||||
|
|
||||||
|
function keymap.on_key_released(k)
|
||||||
|
return on_key_released(remap_key(k))
|
||||||
|
end
|
||||||
|
|
103
vendor/lite-plugins/plugins/markers.lua
vendored
Normal file
103
vendor/lite-plugins/plugins/markers.lua
vendored
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
-- Markers plugin for lite text editor
|
||||||
|
-- original implementation by Petri Häkkinen
|
||||||
|
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
local style = require "core.style"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
local Doc = require "core.doc"
|
||||||
|
|
||||||
|
local cache = {} -- this table contains subtables for each document, each subtable is a set of line numbers
|
||||||
|
setmetatable(cache, {
|
||||||
|
__mode = "k",
|
||||||
|
__index = function(t, k)
|
||||||
|
t[k] = {}
|
||||||
|
return t[k]
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local function shift_lines(doc, at, diff)
|
||||||
|
if diff == 0 then return end
|
||||||
|
local t = {}
|
||||||
|
for line in pairs(cache[doc]) do
|
||||||
|
line = line >= at and line + diff or line
|
||||||
|
t[line] = true
|
||||||
|
end
|
||||||
|
cache[doc] = t
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local raw_insert = Doc.raw_insert
|
||||||
|
|
||||||
|
function Doc:raw_insert(line, col, text, ...)
|
||||||
|
raw_insert(self, line, col, text, ...)
|
||||||
|
local line_count = 0
|
||||||
|
for _ in text:gmatch("\n") do
|
||||||
|
line_count = line_count + 1
|
||||||
|
end
|
||||||
|
shift_lines(self, line, line_count)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local raw_remove = Doc.raw_remove
|
||||||
|
|
||||||
|
function Doc:raw_remove(line1, col1, line2, col2, ...)
|
||||||
|
raw_remove(self, line1, col1, line2, col2, ...)
|
||||||
|
shift_lines(self, line2, line1 - line2)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local draw_line_gutter = DocView.draw_line_gutter
|
||||||
|
|
||||||
|
function DocView:draw_line_gutter(idx, x, y)
|
||||||
|
if cache[self.doc] and cache[self.doc][idx] then
|
||||||
|
local h = self:get_line_height()
|
||||||
|
renderer.draw_rect(x, y, style.padding.x * 0.4, h, style.selection)
|
||||||
|
end
|
||||||
|
draw_line_gutter(self, idx, x, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["markers:toggle-marker"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local line = doc:get_selection()
|
||||||
|
local markers = cache[doc]
|
||||||
|
|
||||||
|
if markers[line] then
|
||||||
|
markers[line] = nil
|
||||||
|
else
|
||||||
|
markers[line] = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
["markers:go-to-next-marker"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local line = doc:get_selection()
|
||||||
|
local markers = cache[doc]
|
||||||
|
|
||||||
|
local first_marker = math.huge
|
||||||
|
local next_marker = math.huge
|
||||||
|
for l, _ in pairs(markers) do
|
||||||
|
if l > line and l < next_marker then
|
||||||
|
next_marker = l
|
||||||
|
end
|
||||||
|
first_marker = math.min(first_marker, l)
|
||||||
|
end
|
||||||
|
if next_marker == math.huge then
|
||||||
|
next_marker = first_marker
|
||||||
|
end
|
||||||
|
if next_marker ~= math.huge then
|
||||||
|
doc:set_selection(next_marker, 1)
|
||||||
|
core.active_view:scroll_to_line(next_marker, true)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["ctrl+f2"] = "markers:toggle-marker",
|
||||||
|
["f2"] = "markers:go-to-next-marker",
|
||||||
|
}
|
46
vendor/lite-plugins/plugins/motiontrail.lua
vendored
Normal file
46
vendor/lite-plugins/plugins/motiontrail.lua
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
local core = require "core"
|
||||||
|
local config = require "core.config"
|
||||||
|
local style = require "core.style"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
config.motiontrail_steps = 50
|
||||||
|
|
||||||
|
|
||||||
|
local function lerp(a, b, t)
|
||||||
|
return a + (b - a) * t
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_caret_rect(dv)
|
||||||
|
local line, col = dv.doc:get_selection()
|
||||||
|
local x, y = dv:get_line_screen_position(line)
|
||||||
|
x = x + dv:get_col_x_offset(line, col)
|
||||||
|
return x, y, style.caret_width, dv:get_line_height()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local last_x, last_y, last_view
|
||||||
|
|
||||||
|
local draw = DocView.draw
|
||||||
|
|
||||||
|
function DocView:draw(...)
|
||||||
|
draw(self, ...)
|
||||||
|
if self ~= core.active_view then return end
|
||||||
|
|
||||||
|
local x, y, w, h = get_caret_rect(self)
|
||||||
|
|
||||||
|
if last_view == self and (x ~= last_x or y ~= last_y) then
|
||||||
|
local lx = x
|
||||||
|
for i = 0, 1, 1 / config.motiontrail_steps do
|
||||||
|
local ix = lerp(x, last_x, i)
|
||||||
|
local iy = lerp(y, last_y, i)
|
||||||
|
local iw = math.max(w, math.ceil(math.abs(ix - lx)))
|
||||||
|
renderer.draw_rect(ix, iy, iw, h, style.caret)
|
||||||
|
lx = ix
|
||||||
|
end
|
||||||
|
core.redraw = true
|
||||||
|
end
|
||||||
|
|
||||||
|
last_view, last_x, last_y = self, x, y
|
||||||
|
end
|
||||||
|
|
30
vendor/lite-plugins/plugins/openfilelocation.lua
vendored
Normal file
30
vendor/lite-plugins/plugins/openfilelocation.lua
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local config = require "core.config"
|
||||||
|
|
||||||
|
|
||||||
|
if PLATFORM == "Windows" then
|
||||||
|
config.filemanager = "explorer"
|
||||||
|
elseif PLATFORM == "Mac OS X" then
|
||||||
|
config.filemanager = "open"
|
||||||
|
else
|
||||||
|
config.filemanager = "xdg-open"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["open-file-location:open-file-location"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
if not doc.filename then
|
||||||
|
core.error "Cannot open location of unsaved doc"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local folder = doc.filename:match("^(.*)[/\\].*$") or "."
|
||||||
|
core.log("Opening \"%s\"", folder)
|
||||||
|
if PLATFORM == "Windows" then
|
||||||
|
system.exec(string.format("%s %s", config.filemanager, folder))
|
||||||
|
else
|
||||||
|
system.exec(string.format("%s %q", config.filemanager, folder))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
26
vendor/lite-plugins/plugins/openselected.lua
vendored
Normal file
26
vendor/lite-plugins/plugins/openselected.lua
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["open-selected:open-selected"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
if not doc:has_selection() then
|
||||||
|
core.error("No text selected")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local text = doc:get_text(doc:get_selection())
|
||||||
|
core.log("Opening \"%s\"...", text)
|
||||||
|
|
||||||
|
if PLATFORM == "Windows" then
|
||||||
|
system.exec("start " .. text)
|
||||||
|
else
|
||||||
|
system.exec(string.format("xdg-open %q", text))
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
keymap.add { ["ctrl+shift+o"] = "open-selected:open-selected" }
|
128
vendor/lite-plugins/plugins/projectmanager.lua
vendored
Normal file
128
vendor/lite-plugins/plugins/projectmanager.lua
vendored
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
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
|
110
vendor/lite-plugins/plugins/scale.lua
vendored
Normal file
110
vendor/lite-plugins/plugins/scale.lua
vendored
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
local core = require "core"
|
||||||
|
local common = require "core.common"
|
||||||
|
local command = require "core.command"
|
||||||
|
local config = require "core.config"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
local style = require "core.style"
|
||||||
|
local RootView = require "core.rootview"
|
||||||
|
local CommandView = require "core.commandview"
|
||||||
|
|
||||||
|
config.scale_mode = "code"
|
||||||
|
config.scale_use_mousewheel = true
|
||||||
|
|
||||||
|
local 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 }
|
||||||
|
|
||||||
|
|
||||||
|
local load_font = renderer.font.load
|
||||||
|
function renderer.font.load(...)
|
||||||
|
local res = load_font(...)
|
||||||
|
font_cache[res] = { ... }
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function scale_font(font, s)
|
||||||
|
local fc = font_cache[font]
|
||||||
|
return renderer.font.load(fc[1], fc[2] * s)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local current_scale = SCALE
|
||||||
|
local default = current_scale
|
||||||
|
|
||||||
|
|
||||||
|
local function get_scale() return current_scale end
|
||||||
|
|
||||||
|
|
||||||
|
local function set_scale(scale)
|
||||||
|
scale = common.clamp(scale, 0.2, 6)
|
||||||
|
|
||||||
|
-- save scroll positions
|
||||||
|
local scrolls = {}
|
||||||
|
for _, view in ipairs(core.root_view.root_node:get_children()) do
|
||||||
|
local n = view:get_scrollable_size()
|
||||||
|
if n ~= math.huge and not view:is(CommandView) then
|
||||||
|
scrolls[view] = view.scroll.y / (n - view.size.y)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local s = scale / current_scale
|
||||||
|
current_scale = scale
|
||||||
|
|
||||||
|
if config.scale_mode == "ui" then
|
||||||
|
SCALE = current_scale
|
||||||
|
|
||||||
|
style.padding.x = style.padding.x * s
|
||||||
|
style.padding.y = style.padding.y * s
|
||||||
|
style.divider_size = style.divider_size * s
|
||||||
|
style.scrollbar_size = style.scrollbar_size * s
|
||||||
|
style.caret_width = style.caret_width * s
|
||||||
|
style.tab_width = style.tab_width * s
|
||||||
|
|
||||||
|
style.big_font = scale_font(style.big_font, s)
|
||||||
|
style.icon_font = scale_font(style.icon_font, s)
|
||||||
|
style.font = scale_font(style.font, s)
|
||||||
|
end
|
||||||
|
|
||||||
|
style.code_font = scale_font(style.code_font, s)
|
||||||
|
|
||||||
|
-- restore scroll positions
|
||||||
|
for view, n in pairs(scrolls) do
|
||||||
|
view.scroll.y = n * (view:get_scrollable_size() - view.size.y)
|
||||||
|
view.scroll.to.y = view.scroll.y
|
||||||
|
end
|
||||||
|
|
||||||
|
core.redraw = true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local on_mouse_wheel = RootView.on_mouse_wheel
|
||||||
|
|
||||||
|
function RootView:on_mouse_wheel(d, ...)
|
||||||
|
if keymap.modkeys["ctrl"] and config.scale_use_mousewheel then
|
||||||
|
if d < 0 then command.perform "scale:decrease" end
|
||||||
|
if d > 0 then command.perform "scale:increase" end
|
||||||
|
else
|
||||||
|
return on_mouse_wheel(self, d, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["ctrl+0"] = "scale:reset",
|
||||||
|
["ctrl+-"] = "scale:decrease",
|
||||||
|
["ctrl+="] = "scale:increase",
|
||||||
|
}
|
||||||
|
|
||||||
|
return { get_scale = get_scale, set_scale = set_scale }
|
||||||
|
|
41
vendor/lite-plugins/plugins/scalestatus.lua
vendored
Normal file
41
vendor/lite-plugins/plugins/scalestatus.lua
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
--[[
|
||||||
|
scalestatus.lua
|
||||||
|
displays current scale (zoom) in status view
|
||||||
|
version: 20200628_155804
|
||||||
|
originally by SwissalpS
|
||||||
|
|
||||||
|
Depends on plugin scale.lua version >= 20200628_154010
|
||||||
|
--]]
|
||||||
|
local scale = require "plugins.scale"
|
||||||
|
-- make sure plugin is installed and has get_scale field
|
||||||
|
if not scale.get_scale then
|
||||||
|
local core = require "core"
|
||||||
|
core.error("Plugin 'scale' needs to be updated, scalestatus inactive.")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local config = require "core.config"
|
||||||
|
local StatusView = require "core.statusview"
|
||||||
|
|
||||||
|
config.scalestatus_format = '%.0f%%'
|
||||||
|
|
||||||
|
local get_items = StatusView.get_items
|
||||||
|
function StatusView:get_items()
|
||||||
|
|
||||||
|
local left, right = get_items(self)
|
||||||
|
|
||||||
|
local t = {
|
||||||
|
self.separator,
|
||||||
|
string.format(config.scalestatus_format, scale.get_scale() * 100),
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, item in ipairs(t) do
|
||||||
|
table.insert(right, item)
|
||||||
|
end
|
||||||
|
|
||||||
|
return left, right
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
37
vendor/lite-plugins/plugins/selectionhighlight.lua
vendored
Normal file
37
vendor/lite-plugins/plugins/selectionhighlight.lua
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
local style = require "core.style"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
-- originally written by luveti
|
||||||
|
|
||||||
|
local function draw_box(x, y, w, h, color)
|
||||||
|
local r = renderer.draw_rect
|
||||||
|
local s = math.ceil(SCALE)
|
||||||
|
r(x, y, w, s, color)
|
||||||
|
r(x, y + h - s, w, s, color)
|
||||||
|
r(x, y + s, s, h - s * 2, color)
|
||||||
|
r(x + w - s, y + s, s, h - s * 2, color)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local draw_line_body = DocView.draw_line_body
|
||||||
|
|
||||||
|
function DocView:draw_line_body(idx, x, y)
|
||||||
|
local line1, col1, line2, col2 = self.doc:get_selection(true)
|
||||||
|
if line1 == line2 and col1 ~= col2 then
|
||||||
|
local lh = self:get_line_height()
|
||||||
|
local selected_text = self.doc.lines[line1]:sub(col1, col2 - 1)
|
||||||
|
local current_line_text = self.doc.lines[idx]
|
||||||
|
local last_col = 1
|
||||||
|
while true do
|
||||||
|
local start_col, end_col = current_line_text:find(selected_text, last_col, true)
|
||||||
|
if start_col == nil then break end
|
||||||
|
local x1 = x + self:get_col_x_offset(idx, start_col)
|
||||||
|
local x2 = x + self:get_col_x_offset(idx, end_col + 1)
|
||||||
|
local color = style.selectionhighlight or style.syntax.comment
|
||||||
|
draw_box(x1, y, x2 - x1, lh, color)
|
||||||
|
last_col = end_col + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
draw_line_body(self, idx, x, y)
|
||||||
|
end
|
||||||
|
|
30
vendor/lite-plugins/plugins/sort.lua
vendored
Normal file
30
vendor/lite-plugins/plugins/sort.lua
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local translate = require "core.doc.translate"
|
||||||
|
|
||||||
|
local function split_lines(text)
|
||||||
|
local res = {}
|
||||||
|
for line in (text .. "\n"):gmatch("(.-)\n") do
|
||||||
|
table.insert(res, line)
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["sort:sort"] = function()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
|
||||||
|
local l1, c1, l2, c2, swap = doc:get_selection(true)
|
||||||
|
l1, c1 = translate.start_of_line(doc, l1, c1)
|
||||||
|
l2, c2 = translate.end_of_line(doc, l2, c2)
|
||||||
|
doc:set_selection(l1, c1, l2, c2, swap)
|
||||||
|
|
||||||
|
doc:replace(function(text)
|
||||||
|
local head, body, foot = text:match("(\n*)(.-)(\n*)$")
|
||||||
|
local lines = split_lines(body)
|
||||||
|
table.sort(lines, function(a, b) return a:lower() < b:lower() end)
|
||||||
|
return head .. table.concat(lines, "\n") .. foot
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
179
vendor/lite-plugins/plugins/spellcheck.lua
vendored
Normal file
179
vendor/lite-plugins/plugins/spellcheck.lua
vendored
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
local core = require "core"
|
||||||
|
local style = require "core.style"
|
||||||
|
local config = require "core.config"
|
||||||
|
local command = require "core.command"
|
||||||
|
local common = require "core.common"
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
local Doc = require "core.doc"
|
||||||
|
|
||||||
|
config.spellcheck_files = { "%.txt$", "%.md$", "%.markdown$" }
|
||||||
|
if PLATFORM == "Windows" then
|
||||||
|
config.dictionary_file = EXEDIR .. "/words.txt"
|
||||||
|
else
|
||||||
|
config.dictionary_file = "/usr/share/dict/words"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local last_input_time = 0
|
||||||
|
local word_pattern = "%a+"
|
||||||
|
local words
|
||||||
|
|
||||||
|
core.add_thread(function()
|
||||||
|
local t = {}
|
||||||
|
local i = 0
|
||||||
|
for line in io.lines(config.dictionary_file) do
|
||||||
|
for word in line:gmatch(word_pattern) do
|
||||||
|
t[word:lower()] = true
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
if i % 1000 == 0 then coroutine.yield() end
|
||||||
|
end
|
||||||
|
words = t
|
||||||
|
core.redraw = true
|
||||||
|
core.log_quiet("Finished loading dictionary file: \"%s\"", config.dictionary_file)
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
local function matches_any(filename, ptns)
|
||||||
|
for _, ptn in ipairs(ptns) do
|
||||||
|
if filename:find(ptn) then return true end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function active_word(doc, line, tail)
|
||||||
|
local l, c = doc:get_selection()
|
||||||
|
return l == line and c == tail
|
||||||
|
and doc == core.active_view.doc
|
||||||
|
and system.get_time() - last_input_time < 0.5
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local text_input = Doc.text_input
|
||||||
|
|
||||||
|
function Doc:text_input(...)
|
||||||
|
text_input(self, ...)
|
||||||
|
last_input_time = system.get_time()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
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 words
|
||||||
|
or not matches_any(self.doc.filename or "", config.spellcheck_files) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local s, e = 0, 0
|
||||||
|
local text = self.doc.lines[idx]
|
||||||
|
|
||||||
|
while true do
|
||||||
|
s, e = text:find(word_pattern, e + 1)
|
||||||
|
if not s then break end
|
||||||
|
local word = text:sub(s, e):lower()
|
||||||
|
if not words[word] and not active_word(self.doc, idx, e + 1) then
|
||||||
|
local color = style.spellcheck_error or style.syntax.keyword2
|
||||||
|
local x1 = x + self:get_col_x_offset(idx, s)
|
||||||
|
local x2 = x + self:get_col_x_offset(idx, e + 1)
|
||||||
|
local h = math.ceil(1 * SCALE)
|
||||||
|
renderer.draw_rect(x1, y + self:get_line_height() - h, x2 - x1, h, color)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_word_at_caret()
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local l, c = doc:get_selection()
|
||||||
|
local s, e = 0, 0
|
||||||
|
local text = doc.lines[l]
|
||||||
|
while true do
|
||||||
|
s, e = text:find(word_pattern, e + 1)
|
||||||
|
if c >= s and c <= e + 1 then
|
||||||
|
return text:sub(s, e):lower(), s, e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function compare_words(word1, word2)
|
||||||
|
local res = 0
|
||||||
|
for i = 1, math.max(#word1, #word2) do
|
||||||
|
if word1:byte(i) ~= word2:byte(i) then
|
||||||
|
res = res + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
|
||||||
|
["spell-check:add-to-dictionary"] = function()
|
||||||
|
local word = get_word_at_caret()
|
||||||
|
if words[word] then
|
||||||
|
core.error("\"%s\" already exists in the dictionary", word)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if word then
|
||||||
|
local fp = assert(io.open(config.dictionary_file, "a"))
|
||||||
|
fp:write("\n" .. word .. "\n")
|
||||||
|
fp:close()
|
||||||
|
words[word] = true
|
||||||
|
core.log("Added \"%s\" to dictionary", word)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
["spell-check:replace"] = function()
|
||||||
|
local word, s, e = get_word_at_caret()
|
||||||
|
|
||||||
|
-- find suggestions
|
||||||
|
local suggestions = {}
|
||||||
|
local word_len = #word
|
||||||
|
for w in pairs(words) do
|
||||||
|
if math.abs(#w - word_len) <= 2 then
|
||||||
|
local diff = compare_words(word, w)
|
||||||
|
if diff < word_len * 0.5 then
|
||||||
|
table.insert(suggestions, { diff = diff, text = w })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #suggestions == 0 then
|
||||||
|
core.error("Could not find any suggestions for \"%s\"", word)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- sort suggestions table and convert to properly-capitalized text
|
||||||
|
table.sort(suggestions, function(a, b) return a.diff < b.diff end)
|
||||||
|
local doc = core.active_view.doc
|
||||||
|
local line = doc:get_selection()
|
||||||
|
local has_upper = doc.lines[line]:sub(s, s):match("[A-Z]")
|
||||||
|
for k, v in pairs(suggestions) do
|
||||||
|
if has_upper then
|
||||||
|
v.text = v.text:gsub("^.", string.upper)
|
||||||
|
end
|
||||||
|
suggestions[k] = v.text
|
||||||
|
end
|
||||||
|
|
||||||
|
-- select word and init replacement selector
|
||||||
|
local label = string.format("Replace \"%s\" With", word)
|
||||||
|
doc:set_selection(line, e + 1, line, s)
|
||||||
|
core.command_view:enter(label, function(text, item)
|
||||||
|
text = item and item.text or text
|
||||||
|
doc:replace(function() return text end)
|
||||||
|
end, function(text)
|
||||||
|
local t = {}
|
||||||
|
for _, w in ipairs(suggestions) do
|
||||||
|
if w:lower():find(text:lower(), 1, true) then
|
||||||
|
table.insert(t, w)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
|
||||||
|
})
|
11
vendor/lite-plugins/plugins/titleize.lua
vendored
Normal file
11
vendor/lite-plugins/plugins/titleize.lua
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["titleize:titleize"] = function()
|
||||||
|
core.active_view.doc:replace(function(text)
|
||||||
|
return text:gsub("%f[%w](%w)", string.upper)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
32
vendor/lite-plugins/plugins/togglesnakecamel.lua
vendored
Normal file
32
vendor/lite-plugins/plugins/togglesnakecamel.lua
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
|
||||||
|
|
||||||
|
local function f(x, y)
|
||||||
|
return x .. "_" .. string.lower(y)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function toggle(symbol)
|
||||||
|
if not symbol:match("[a-z]") then
|
||||||
|
return
|
||||||
|
elseif symbol:match("_") then
|
||||||
|
return symbol:gsub("_(.)", string.upper)
|
||||||
|
elseif symbol:match("^[a-z]") then
|
||||||
|
return symbol:gsub("(.)([A-Z])", f):lower()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
command.add("core.docview", {
|
||||||
|
["toggle-snake-camel:toggle"] = function()
|
||||||
|
core.active_view.doc:replace(function(text)
|
||||||
|
return text:gsub("[%w][%w%d_]*", toggle)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["f6"] = "toggle-snake-camel:toggle",
|
||||||
|
}
|
5
vendor/lite-plugins/plugins/unboundedscroll.lua
vendored
Normal file
5
vendor/lite-plugins/plugins/unboundedscroll.lua
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
local DocView = require "core.docview"
|
||||||
|
|
||||||
|
function DocView.clamp_scroll_position()
|
||||||
|
-- do nothing
|
||||||
|
end
|
164
vendor/lite-plugins/plugins/workspace.lua
vendored
Normal file
164
vendor/lite-plugins/plugins/workspace.lua
vendored
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
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
|
Loading…
Reference in a new issue