]> git.r.bdr.sh - rbdr/tree-sitter-api-notation/commitdiff
Add lua plugin
authorRuben Beltran del Rio <redacted>
Wed, 4 Oct 2023 14:09:46 +0000 (16:09 +0200)
committerRuben Beltran del Rio <redacted>
Wed, 4 Oct 2023 14:09:46 +0000 (16:09 +0200)
README.md [new file with mode: 0644]
lua/tree-sitter-api-notation/init.lua [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
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 (file)
index 0000000..d21f441
--- /dev/null
@@ -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
+})