🌳 Treesitter support for Lite XL.
Evergreen adds Treesitter syntax highlighting support for Lite XL. It is work in progress, but functions well.
Warning Evergreen is only tested on Linux and will definitely not work on Windows.
Without Evergreen | With Evergreen |
---|---|
Evergreen can be easily installed with Miq by adding this to your plugin declaration:
{'TorchedSammy/Evergreen.lxl'},
Evergreen can be installed using lpm for Lite XL or ppm for Pragtical:
lpm install evergreen
ppm install evergreen
- Git clone Evergreen into Lite XL plugins directory
- Or symlink:
cd ~/Downloads
git clone https://github.com/Evergreen-lxl/Evergreen.lxl
ln -s ~/Downloads/Evergreen.lxl ~/.config/lite-xl/plugins/evergreen
Plugin managers will handle the installation of the lua_tree_sitter
library
automatically.
You can download the library from
here, and then place
it inside the libraries/tree_sitter
directory inside your user directory.
Rename the binary to init.so
.
Automated builds for some languages are available in evergreen-languages. Follow the instructions inside the README there to install.
Languages can also be manually configured as such:
local evergreenLangs = require 'plugins.evergreen.languages'
evergreenLangs.addDef {
name = 'foo',
files = { '%.foo$', '%.bar$' },
path = '~/tree-sitter-foo',
soFile = 'parser{SOEXT}',
queryFiles = {
highlights = 'queries/highlights.scm',
},
}
Option | Default | Description |
---|---|---|
name |
identifier for the language. must be unique | |
files |
{} |
list of patterns that matches filenames of this language |
path |
directory where the shared library and queries are located | |
soFile |
'parser{SOEXT}' |
location of the shared library inside path |
queryFiles.highlights |
'queries/highlights.scm' |
location of the highlights query inside path |
For soFile
, the placeholder {SOEXT}
will be replaced with
the configured shared library extension.
It is perfectly fine to have the parser not exist,
as long as the files
option is an empty list or left out.
This implies that the language definition is only used for
inheritance from its queries.
Evergreen extends the set of highlight groups that Lite XL provides.
You can set individual colors for these groups in the style.syntax
table,
just as you would with regular syntax types in Lite XL:
local common = require 'core.common'
local style = require 'core.style'
style.syntax['<name>'] = { common.color '#ffffff' }
style.syntax['<name>.<subcategory>'] = { common.color '#123456' }
By default, Evergreen has a fallback mechanism for a limited set of highlights. The fallbacks cover groups defined by Nvim (see here). A warning is generated if any fallbacks were used.
Evergreen will try to use the colors from default Lite XL syntax types to set these fallbacks. However, due to not having a close approximate, the fallbacks for these groups may not make sense, and you may want to set them explicitly:
diff.plus
diff.minus
diff.delta
comment.error
comment.warning
comment.todo
comment.note
Additionally, since there are a lot of groups to give more fine-grained control, some may find that they do not need to set all of them explicitly. If you wish to disable the fallback mechanism or the warning, set the respective configuration options correspondingly.
Set configuration options for Evergreen by adding this to your user module:
local evergreenConfig = require 'plugins.evergreen.config'
evergreenConfig.option1 = false
evergreenConfig.option2 = 1000
Option | Default | Description |
---|---|---|
useFallbackColors |
true |
set fallbacks for missing colors |
warnFallbackColors |
true |
warn when fallback colors are used |
soExt |
.so /.dll |
shared library extension (.dll on Windows, .so otherwise) |
MIT