aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--plugins/language_objc.lua61
-rw-r--r--plugins/language_odin.lua56
-rw-r--r--plugins/language_teal.lua55
-rw-r--r--plugins/tabnumbers.lua27
5 files changed, 166 insertions, 38 deletions
diff --git a/README.md b/README.md
index 3701607..8ce6a00 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ Plugin | Description
[`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
+[`fallbackfonts`](https://github.com/takase1121/lite-fallback-fonts)* | Adds support for fallback fonts *([gif](https://raw.githubusercontent.com/takase1121/lite-fallback-fonts/master/assets/Iw18fI57J0.gif))*
[`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
@@ -54,6 +55,7 @@ Plugin | Description
[`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_nim`](plugins/language_nim.lua?raw=1) | Syntax for the [Nim](https://nim-lang.org) programming language
+[`language_objc`](plugins/language_objc.lua?raw=1) | Syntax for the [Objective C](https://en.wikipedia.org/wiki/Objective-C) programming language
[`language_odin`](plugins/language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) programming language
[`language_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
@@ -61,6 +63,7 @@ Plugin | Description
[`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_teal`](plugins/language_teal.lua?raw=1) | Syntax for the [Teal](https://github.com/teal-language/tl) programming language, a typed dialect of Lua.
[`language_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language
[`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language
[`lastproject`](plugins/lastproject.lua?raw=1) | Loads the last loaded project if lite is launched without any arguments
@@ -68,6 +71,7 @@ Plugin | Description
[`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
+[`lint+`](https://github.com/liquid600pgm/lintplus)* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))*
[`macmodkeys`](plugins/macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt`
[`markers`](plugins/markers.lua?raw=1) | Add markers to docs and jump between them quickly *([screenshot](https://user-images.githubusercontent.com/3920290/82252149-5faaa200-9946-11ea-9199-bea2efb7ee23.png))*
[`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))*
@@ -80,6 +84,7 @@ Plugin | Description
[`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*
+[`tabnumbers`](plugins/tabnumbers.lua?raw=1) | Displays tab numbers from 1–9 next to their names *([screenshot](https://user-images.githubusercontent.com/16415678/101285362-007a8500-37e5-11eb-869b-c10eb9d9d902.png))
[`theme16`](https://github.com/monolifed/theme16)* | Theme manager with base16 themes
[`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`
diff --git a/plugins/language_objc.lua b/plugins/language_objc.lua
new file mode 100644
index 0000000..221e5c3
--- /dev/null
+++ b/plugins/language_objc.lua
@@ -0,0 +1,61 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = { "%.m$" },
+ 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 = "keyword2" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ },
+ symbols = {
+ ["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"] = "literal",
+ ["false"] = "literal",
+ ["NULL"] = "literal",
+ ["nil"] = "literal",
+ },
+}
+
diff --git a/plugins/language_odin.lua b/plugins/language_odin.lua
index fb60a6c..c3413f2 100644
--- a/plugins/language_odin.lua
+++ b/plugins/language_odin.lua
@@ -4,23 +4,23 @@ 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" },
+ { 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 = "[<>~=+-*/]=", type = "operator" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&:]", type = "operator" },
+ { pattern = "%$[%a_][%w_]*", type = "operator" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[#@][%a_][%w_]*", type = "keyword2" },
+ { pattern = "[#@]%b()", type = "keyword2" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
-- Keywords
@@ -36,7 +36,7 @@ syntax.add {
["switch"] = "keyword",
["case"] = "keyword",
["in"] = "keyword",
- ["notin"] = "keyword",
+ ["not_in"] = "keyword",
["do"] = "keyword",
["break"] = "keyword",
["continue"] = "keyword",
@@ -79,26 +79,6 @@ syntax.add {
["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",
diff --git a/plugins/language_teal.lua b/plugins/language_teal.lua
new file mode 100644
index 0000000..8ab4c33
--- /dev/null
+++ b/plugins/language_teal.lua
@@ -0,0 +1,55 @@
+local syntax = require "core.syntax"
+
+syntax.add {
+ files = {"%.tl$","%.d.tl$"},
+ comment = "--",
+ patterns = {
+ { 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 = "<%a+>", type = "keyword2" },
+ { 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",
+ ["global"] = "keyword",
+ ["in"] = "keyword",
+ ["not"] = "keyword",
+ ["and"] = "keyword",
+ ["or"] = "keyword",
+ ["goto"] = "keyword",
+ ["enum"] = "keyword",
+ ["record"] = "keyword",
+ ["any"] = "keyword2",
+ ["boolean"] = "keyword2",
+ ["number"] = "keyword2",
+ ["string"] = "keyword2",
+ ["thread"] = "keyword2",
+ ["true"] = "literal",
+ ["false"] = "literal",
+ ["nil"] = "literal",
+ },
+}
diff --git a/plugins/tabnumbers.lua b/plugins/tabnumbers.lua
new file mode 100644
index 0000000..deabbcd
--- /dev/null
+++ b/plugins/tabnumbers.lua
@@ -0,0 +1,27 @@
+local common = require "core.common"
+local core = require "core"
+local style = require "core.style"
+
+-- quite hackish, but Node isn't normally public
+local Node = getmetatable(core.root_view.root_node)
+local draw_tabs = Node.draw_tabs
+
+function Node:draw_tabs(...)
+ draw_tabs(self, ...)
+
+ for i, view in ipairs(self.views) do
+ if i > 9 then break end
+
+ local x, y, w, h = self:get_tab_rect(i)
+ local number = tostring(i)
+ local color = style.dim
+ local title_width = style.font:get_width(view:get_name())
+ local free_real_estate =
+ math.min(math.max((w - title_width) / 2, style.padding.x), h)
+ if view == self.active_view then
+ color = style.accent
+ end
+ -- renderer.draw_rect(x, y + h - 1, free_real_estate, 1, color)
+ common.draw_text(style.font, color, tostring(i), "center", x, y, free_real_estate, h)
+ end
+end