From 1bfefd1f98dae54576a54b59b42379b275a00414 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 20 Oct 2023 13:03:50 +0200 Subject: [PATCH] docs: add hint on configuring custom filetypes (#5552) I thought that this functionality was not possible but there's actually an API for it. This seems like a useful place for others to find more information on it. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index bf1ee51e1..fd99ad748 100644 --- a/README.md +++ b/README.md @@ -745,3 +745,15 @@ require'nvim-treesitter.configs'.setup { -- } ``` + +#### Using an existing parser for another filetype + +For example, to use the `bash` tree-sitter to highlight file with +`filetype=apkbuild`, use: + +```lua +vim.treesitter.language.register("bash", "apkbuild") +``` + +The `bash` tree-sitter must be installed following the usual procedure [as +described above](#language-parsers).