From: Ruben Beltran del Rio Date: Wed, 4 Oct 2023 14:09:46 +0000 (+0200) Subject: Add lua plugin X-Git-Url: https://git.r.bdr.sh/rbdr/tree-sitter-api-notation/commitdiff_plain/c47550bd1b78cee79c22d7c2ab4f7f77e4c696be Add lua plugin --- diff --git a/README.md b/README.md new file mode 100644 index 0000000..32ffbdd --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# tree-sitter-api-notation + +This is a tree-sitter parser for [api-notation][api-notation]. + +## Neovim plugin + +If you use `nvim-treesitter`, you can also include this as a plugin and it will +make sure it's configured correctly. + +``` +require('lazy').setup({ + ... + 'https://git.sr.ht/~rbdr/tree-sitter-api-notation' + ... +} +``` + +[api-notation]: https://unlimited.pizza/api.html diff --git a/lua/tree-sitter-api-notation/init.lua b/lua/tree-sitter-api-notation/init.lua new file mode 100644 index 0000000..d21f441 --- /dev/null +++ b/lua/tree-sitter-api-notation/init.lua @@ -0,0 +1,12 @@ +local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs() +parser_config.api_notation = { + install_info = { + url = 'https://git.sr.ht/~rbdr/tree-sitter-api-notation', -- local path or git repo + files = {'src/parser.c'}, + branch = 'main' + } +} +vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, { + pattern = {'*.api', '*.apinotation'}, + callback = function () vim.opt.filetype = 'api_notation' end +})