🌳 Treesitter support for Lite XL.
Evergreen adds Treesitter syntax highlighting support for Lite XL. It is work in progress, but functions well.
Note
Evergreen is only extensively tested on Linux, but it should work correctly on MacOS and Windows based on brief testing.
Without Evergreen | With Evergreen |
---|---|
![]() |
![]() |
Evergreen can be easily installed with Miq by adding this to your plugin declaration:
{'Evergreen-lxl/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 corresponding configuration options.
Since v0.3.1, Evergreen supports the use of the settings GUI.
Find the options under Plugins > Evergreen
.
Options for Evergreen can be modified in the user module:
local config = require 'core.config'
config.plugins.evergreen.option1 = false
config.plugins.evergreen.option2 = 1000
Prior to v0.3.1, options were set in the plugins.evergreen.config
module instead. This is still supported but discouraged to stay consistent
with other plugins.
Option | Default | Description |
---|---|---|
useFallbackColors |
true |
Set fallbacks for missing colors |
warnFallbackColors |
true |
Warn when fallback colors are used |
Option | Default | Description |
---|---|---|
maxParseTime |
2000 |
Maximum time spent parsing before deferring it (in µs). Set this to 0 to disable deferring |
MIT