doc: mention vim.filetype.add() in README

...instead of `ftdetect` additions
This commit is contained in:
Christian Clason 2022-03-27 18:25:52 +02:00 committed by Christian Clason
parent b995eebe84
commit 97691940d1

View file

@ -382,8 +382,7 @@ Once the parser is installed, you can update it (from the latest revision of the
Note that neither `:TSInstall` nor `:TSInstallFromGrammar` copy query files from the grammar repository. Note that neither `:TSInstall` nor `:TSInstallFromGrammar` copy query files from the grammar repository.
If you want your installed grammar to be useful, you must manually [add query files](#adding-queries) to your local nvim-treesitter installation. If you want your installed grammar to be useful, you must manually [add query files](#adding-queries) to your local nvim-treesitter installation.
Note also that module functionality is only triggered if your language's filetype is correctly identified. Note also that module functionality is only triggered if your language's filetype is correctly identified.
If Neovim does not detect your language's filetype by default, you can add a short Vimscript file to nvim-treesitter's `ftdetect` runtime directory. If Neovim does not detect your language's filetype by default, you can use [Neovim's `vim.filetype.add()`](https://neovim.io/doc/user/lua.html#vim.filetype.add()) (0.7.0 and above) to add a custom detection rule.
See [Neovim's documentation](https://neovim.io/doc/user/filetype.html#new-filetype) on how to use Vimscript to detect a filetype.
If you use a git repository for your parser and want to use a specific version, you can set the `revision` key If you use a git repository for your parser and want to use a specific version, you can set the `revision` key
in the `install_info` table for you parser config. in the `install_info` table for you parser config.