Tree-sitter grammar for Hygen templates
MIT License
Tree-sitter grammar for Hygen templates.
embedded-template
:ejs
tags
bash
:metadata.value
when metadata.key
is sh
javascript
:code
nodesAdd the following to your init.lua
or respective config file:
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
-- NOTE: add the parser to `parser_config` before calling `setup()`
parser_config.hygen_template = {
install_info = {
url = "https://github.com/Hdoc1509/tree-sitter-hygen-template",
files = { "src/parser.c" },
generate_requires_npm = true,
revision = 'release',
},
filetype = "hygen",
}
require('nvim-treesitter.configs').setup({
ensure_installed = {
--- other parsers
'hygen_template',
},
-- other options
})
Copy the queries from queries
directory to
queries/hygen_template
directory in your neovim
configuration directory:
With | Path |
---|---|
Unix | ~/.config/nvim |
Windows | ~/AppData/Local/nvim |
XDG_CONFIG_HOME set |
$XDG_CONFIG_HOME/nvim |
Copy the filetype.vim
file to your neovim
configuration directory ftdetect
subdirectory as hygen.vim
.
[!NOTE]
hygen
filetype will match all files withname.ext.hygen
pattern, whereext
will be used to extract the parser to be injected.
Copy the directive.lua
file to your neovim
configuration directory and add the following to your init.lua
or
respective config file:
local hygen_directive = require('path-to.hygen-directive')
local directives = { hygen_directive }
for _, directive in ipairs(directives) do
vim.treesitter.query.add_directive(
directive.name,
directive.callback,
directive.options
)
end