aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-08-12 23:06:08 +0200
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-08-14 16:42:53 +0200
commita9abe2b9b084958ffcbf8a696ced416eff24fbfe (patch)
treed87e0dae1ee504dffbdf9e52922c716450b807e4 /doc
parentfeat: intuitive runtime queries (diff)
downloadnvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.tar
nvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.tar.gz
nvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.tar.bz2
nvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.tar.lz
nvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.tar.xz
nvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.tar.zst
nvim-treesitter-a9abe2b9b084958ffcbf8a696ced416eff24fbfe.zip
docs: document the new runtime query system
Diffstat (limited to 'doc')
-rw-r--r--doc/nvim-treesitter.txt20
1 files changed, 13 insertions, 7 deletions
diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt
index 7e4f749cf..aa3ca2043 100644
--- a/doc/nvim-treesitter.txt
+++ b/doc/nvim-treesitter.txt
@@ -104,15 +104,21 @@ By default, everything is disabled. To enable support for features, in your `ini
==============================================================================
USER QUERY EXTENSIONS *nvim-treesitter-query-extensions*
-You can add your own query files by placing a query file in vim's runtime path
-after `nvim-treesitter` is sourced. If the language has a built in query file,
-that file will be appended to or it will be used (useful for languages not yet
-supported).
+Queries are what `nvim-treesitter` uses to extract informations from the syntax tree, and they are
+located in the `queries/{lang}/*` runtime directories (like the `queries` folder of this plugin).
-For example, you can add files to `<vim-config-dir>/after/queries/lua/highlights.scm`
-to add more queries to lua highlights. You can also manually add query paths
-to the runtime path by adding this to your vim config `set rtp+='path/to/queries'`.
+`nvim-treesitter` considers queries as any runtime file (see `:h rtp`), that is :
+- if the file is in any `after/queries/` folder, then it will be used to extend the already defined
+ queries.
+- Otherwise, it will be used as a base to define the query, the first query found (with the highest
+ priority) will be the only one to be used.
+
+This hybrid approach is the most standard way, and according to that, here is some ideas on how to
+use is :
+- If you want to rewrite (or write) a query, don't use `after/queries`.
+- If you want to override a part of a query (only one match for example), use the `after/queries`
+ directory.
==============================================================================
COMMANDS *nvim-treesitter-commands*