aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-02-24 09:49:16 +0000
committerLewis Russell <me@lewisr.dev>2023-02-24 10:09:43 +0000
commit801ef85f931e903192463c03d919a63b6d4023f9 (patch)
tree77a254159e994e16c15e39024622e7503439e4c2 /README.md
parentfeat!: remove support for used_by in parser configs (diff)
downloadnvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.tar
nvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.tar.gz
nvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.tar.bz2
nvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.tar.lz
nvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.tar.xz
nvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.tar.zst
nvim-treesitter-801ef85f931e903192463c03d919a63b6d4023f9.zip
feat: use vim.treesitter.language.get_lang/add/register()
Diffstat (limited to 'README.md')
-rw-r--r--README.md7
1 files changed, 4 insertions, 3 deletions
diff --git a/README.md b/README.md
index c5a36c4e2..2a6ebf5e5 100644
--- a/README.md
+++ b/README.md
@@ -481,13 +481,14 @@ parser_config.zimbu = {
}
```
-If you wish to set a specific parser for a filetype, you should extend the `filetype_to_parsername` table:
+If you wish to set a specific parser for a filetype, you should use `vim.treesitter.language.register()`:
```lua
-local ft_to_parser = require"nvim-treesitter.parsers".filetype_to_parsername
-ft_to_parser.someft = "python" -- the someft filetype will use the python parser and queries.
+vim.treesitter.language.register('python', 'someft') -- the someft filetype will use the python parser and queries.
```
+Note this requires Nvim v0.9.
+
4. Start `nvim` and `:TSInstall zimbu`.
You can also skip step 2 and use `:TSInstallFromGrammar zimbu` to install directly from a `grammar.js` in the top-level directory specified by `url`.