aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorHugo <hugo@whynothugo.nl>2023-10-20 13:03:50 +0200
committerGitHub <noreply@github.com>2023-10-20 20:03:50 +0900
commit1bfefd1f98dae54576a54b59b42379b275a00414 (patch)
tree6a7cd5fc9a00160e04898153349004cca645aebe /README.md
parentUpdate parsers: sql, wing (diff)
downloadnvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.tar
nvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.tar.gz
nvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.tar.bz2
nvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.tar.lz
nvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.tar.xz
nvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.tar.zst
nvim-treesitter-1bfefd1f98dae54576a54b59b42379b275a00414.zip
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.
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 12 insertions, 0 deletions
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).