diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2023-02-24 09:49:16 +0000 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2023-02-24 10:09:43 +0000 |
| commit | 801ef85f931e903192463c03d919a63b6d4023f9 (patch) | |
| tree | 77a254159e994e16c15e39024622e7503439e4c2 /README.md | |
| parent | feat!: remove support for used_by in parser configs (diff) | |
| download | nvim-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.md | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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`. |
