A Jinja Engine for Neovim
November 21, 2024 ยท View on GitHub
Motivation of the Plugin
This plugin aims to offer an easy way to use the Jinja2 template engine in Neovim. It utilizes the lupa engine, providing a straightforward method to integrate Lupa into Neovim.
Installation
-- Lazy.nvim
{
"you-n-g/jinja-engine.nvim",
dependencies = {
},
}
Demo
It is common to use you-n-g/jinja-engine.nvim to develop other Neovim plugins. For example, if you have installed you-n-g/jinja-engine.nvim as a dependency of your plugin, like this:
-- Lazy.nvim
{
"<your-plugin>.nvim",
dependencies = {
"you-n-g/jinja-engine.nvim",
},
}
Then you can use Jinja in your code like this:
print(require('jinja').lupa.expand("hello {{ s }}!", {s = "world"}))
print(require('jinja').lupa.expand("{% for i in {1, 2, 3} %}{{ i }}{% endfor %}"))
More advanced use cases can be found in lupa.
TODO
Development
We welcome contributions to this project.
You can test the plugin in the UI with minimal config using:
vim -u tests/init_conf/lazy.lua -U NONE -N -i NONEfor lazy.nvim
If you prefer to run tests without a user interface, you can execute make test to initiate the test suite.