From 7488dd5649a46ad03fac5461e4cda6b9004327a3 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sat, 25 Jun 2022 00:15:40 +0800 Subject: [PATCH] Initial commit --- LICENSE | 21 +++++++++++++++++++++ README.md | 29 +++++++++++++++++++++++++++++ language_ignore.lua | 24 ++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 language_ignore.lua diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..82b8da5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Антон Аксенов (aka Anthony Axenov) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f0c94e --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# env syntax support plugin for lite-xl + +[Lite-XL](https://lite-xl.com/) is lightweight, fast and customizable open-source code editor. + +This plugin adds extra syntax highlighting for such fyletypes: +* `.gitignore` +* `.dockerignore` +* and any other `.blablablaignore` which has identical simple syntax rules. + +Supported highlighting: +* comments; +* excluded (ignored) patterns; +* included (not-ignored) patterns. + +You can use any of [these files](https://github.com/github/gitignore) to check how plugin works (just rename it to `.gitignore` or `.dockerignore`). + +## How to install + +To install a plugin: + +* Drop `language_env.lua` file in: + * Linux: `~/.config/lite-xl/plugins/` + * MacOS: `~/.config/lite-xl/plugins/` + * Windows: `C:\Users\(username)\.config\lite-xl\plugins\` +* If lite-xl is already opened then `Ctrl+Shift+P => rst => ` to reboot editor's core and load plugin immidiately. + +## License + +[The MIT License](LICENSE) diff --git a/language_ignore.lua b/language_ignore.lua new file mode 100644 index 0000000..2f380bd --- /dev/null +++ b/language_ignore.lua @@ -0,0 +1,24 @@ +-- mod-version:2 + +-- Anthony Axenov (c) 2022, The MIT License +-- https://github.com/anthonyaxenov/lite-xl-env-syntax + +local syntax = require "core.syntax" +local style = require "core.style" +local common = require "core.common" + +style.syntax["ignore"] = { common.color "#72B886" } +style.syntax["exclude"] = { common.color "#F36161" } + +syntax.add { + name = ".ignore file", + files = { "%..*ignore$" }, + comment = "#", + patterns = { + { regex = "^ *#.*$", type = "comment" }, + { regex = { "(?=^ *!.)", "$" }, type = "ignore" }, + { regex = { "(?=.)", "$" }, type = "exclude" }, + }, + symbols = {} +} +