🌳 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 |
---|---|
If you want more languages supported, open an issue.
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/TorchedSammy/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
.
To use Evergreen, you have to install the parser for your language of choice.
This can be done with the Evergreen: Install
command.
The next thing to do is add style variables for the highlighting groups in your config. This can be done like:
local style = require 'core.style'
style.syntax['<name>'] = '#ffffff'
There are a lot of highlight groups to have better control over what specific
parts to highlight. This may be overwhelming for some people though, so
some of these have aliases to the default Lite XL style variables,
and groups like keyword.return
will default to the keyword
group,
conditional.ternary
will default to conditional
if its set, etc.
Evergreen will warn in the log if there are any groups missing, you can look at this to see what to set to highlight.
These are the available highlight groups:
attribute
boolean
: A group to highlight booleans specificallycharacter
comment
comment.documentation
: Doc commentsconditional
: Keywords relating to conditionals (if
/else
)conditional.ternary
constant
constant.builtin
: Constants that are builtins to the language (Go'siota
,nil
)constructor
: Constructors (likenew
functions)define
exception
: Keywords relating to exceptions (try
andcatch
)field
: Like a field in a Lua tablefloat
function
: Function declarationfunction.call
: Function callfunction.macro
function.builtin
include
: Keywords related to including modules/packageskeyword.function
: The function operator in a language (likefunc
in Go)keyword.operator
: Operators that are words (likeand
,or
in Lua)keyword.return
: Thereturn
operatorkeyword.coroutine
label
method
method.call
namespace
number
operator
parameter
: Parameters to a function (in declaration)preproc
: Preprocessor directives (#if
in C)punctuation.delimiter
: Punctuation that delimits items (,
and:
)punctuation.bracket
: Brackets of all kinds (()
or{}
, etc)punctuation.special
:#
in rust, treated as an operator by defaultrepeat
: Keywords relating to loops (while
,for
)storageclass
:static
,const
in Cstorageclass.lifetime
: Specifically for lifetimes in Rust currentlystring
string.escape
: string special character (e.g.:\n
)tag
: HTML/JSX tagstag.delimiter
: <>tag.attribute
: Tag attributestext.diff.add
: Highlights additions in diffstext.diff.delete
: Highlights deletions in diffstype
type.builtin
: Builtin types (int
,bool
)type.definition
type.qualifier
: Type qualifiers (private
,public
)property
: class fieldvariable
variable.builtin
: Builtin variables (this
,self
)error
MIT