docs: Update vimdoc file

Adds the new maintainers (that were actually added a long time ago),
fix inconsistent formatting, and unneeded or old/wrong docs.
This commit is contained in:
Thomas Vigouroux 2021-04-15 16:51:36 +02:00
parent afd5d11519
commit a74484a8ac

View file

@ -1,10 +1,16 @@
*nvim-treesitter* *nvim-treesitter*
Treesitter configurations and abstraction layer for Neovim.
Minimum version of neovim: nightly Minimum version of neovim: nightly
Authors: Yazdani Kiyan <yazdani.kiyan@protonmail.com> Authors:
Vigouroux Thomas <tomvig38@gmail.com> Kiyan Yazdani <yazdani.kiyan@protonmail.com>
https://github.com/nvim-treesitter/nvim-treesitter/graphs/contributors Thomas Vigouroux <tomvig38@gmail.com>
Stephan Seitz <stephan.seitz@fau.de>
Steven Sojka <Steven.Sojka@tdameritrade.com>
Santos Gallegos <stsewd@protonmail.com>
https://github.com/nvim-treesitter/nvim-treesitter/graphs/contributors
Type |gO| to see the table of contents. Type |gO| to see the table of contents.
@ -111,7 +117,6 @@ Supported options:
require'nvim-treesitter.configs'.setup { require'nvim-treesitter.configs'.setup {
highlight = { highlight = {
enable = true, enable = true,
use_languagetree = false, -- Use this to enable language injection
custom_captures = { custom_captures = {
-- Highlight the @foo.bar capture group with the "Identifier" highlight group. -- Highlight the @foo.bar capture group with the "Identifier" highlight group.
["foo.bar"] = "Identifier", ["foo.bar"] = "Identifier",
@ -175,71 +180,52 @@ Supported options:
} }
EOF EOF
< <
==============================================================================
USER QUERY EXTENSIONS *nvim-treesitter-query-extensions*
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).
`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* COMMANDS *nvim-treesitter-commands*
*:TSInstall* *:TSInstall*
:TSInstall| {language} ...~ :TSInstall| {language} ...~
Install one or more treesitter parsers. Install one or more treesitter parsers.
You can use |:TSInstall| `all` to install all parsers. You can use |:TSInstall| `all` to install all parsers.
*:TSInstallInfo* *:TSInstallInfo*
:TSInstallInfo~ :TSInstallInfo~
List informations about currently installed parsers List informations about currently installed parsers
*:TSUpdate* *:TSUpdate*
:TSUpdate {language}~ :TSUpdate {language}~
Update the installed parser of {language} or all installed parsers Update the installed parser of {language} or all installed parsers
if {language} is omitted. if {language} is omitted.
*:TSUninstall* *:TSUninstall*
:TSUninstall {language}~ :TSUninstall {language}~
Deletes the parser for corresponding {language}. You can use 'all' for Deletes the parser for corresponding {language}. You can use 'all' for
language to uninstall all parsers. language to uninstall all parsers.
*:TSBufEnable* *:TSBufEnable*
:TSBufEnable {module}~ :TSBufEnable {module}~
Enable {module} on the current buffer. Enable {module} on the current buffer.
A list of modules can be found at |:TSModuleInfo| A list of modules can be found at |:TSModuleInfo|
*:TSBufDisable* *:TSBufDisable*
:TSBufDisable {module}~ :TSBufDisable {module}~
Disable {module} on the current buffer. Disable {module} on the current buffer.
A list of modules can be found at |:TSModuleInfo| A list of modules can be found at |:TSModuleInfo|
*:TSBufToggle* *:TSBufToggle*
:TSBufToggle {module}~ :TSBufToggle {module}~
Toggle (enable if disabled, disable if enabled) {module} on the current Toggle (enable if disabled, disable if enabled) {module} on the current
buffer. buffer.
A list of modules can be found at |:TSModuleInfo| A list of modules can be found at |:TSModuleInfo|
*:TSEnableAll* *:TSEnableAll*
:TSEnableAll {module} [{language}]~ :TSEnableAll {module} [{language}]~
Enable {module} for the session. Enable {module} for the session.
@ -248,7 +234,7 @@ particular language.
A list of modules can be found at |:TSModuleInfo| A list of modules can be found at |:TSModuleInfo|
A list of languages can be found at |:TSInstallInfo| A list of languages can be found at |:TSInstallInfo|
*:TSDisableAll* *:TSDisableAll*
:TSDisableAll {module} [{language}]~ :TSDisableAll {module} [{language}]~
Disable {module} for the session. Disable {module} for the session.
@ -266,7 +252,7 @@ particular language.
A list of modules can be found at |:TSModuleInfo| A list of modules can be found at |:TSModuleInfo|
A list of languages can be found at |:TSInstallInfo| A list of languages can be found at |:TSInstallInfo|
*:TSModuleInfo* *:TSModuleInfo*
:TSModuleInfo [{module}]~ :TSModuleInfo [{module}]~
List the state for the given module or all modules for the current session in List the state for the given module or all modules for the current session in
@ -281,7 +267,7 @@ These highlight groups are used by default:
highlight default link TSModuleInfoParser Identifier highlight default link TSModuleInfoParser Identifier
< <
*:TSEditQuery* *:TSEditQuery*
:TSEditQuery {query-group} [{lang}]~ :TSEditQuery {query-group} [{lang}]~
Edit the query file for a {query-group} (e.g. highlights, locals) for given Edit the query file for a {query-group} (e.g. highlights, locals) for given
@ -305,29 +291,29 @@ Nvim treesitter has some wrapper functions that you can retrieve with:
local ts_utils = require 'nvim-treesitter.ts_utils' local ts_utils = require 'nvim-treesitter.ts_utils'
< <
Methods Methods
*ts_utils.get_node_at_cursor* *ts_utils.get_node_at_cursor*
get_node_at_cursor(winnr)~ get_node_at_cursor(winnr)~
`winnr` will be 0 if nil. `winnr` will be 0 if nil.
Returns the node under the cursor. Returns the node under the cursor.
*ts_utils.get_node_text* *ts_utils.get_node_text*
get_node_text(node, bufnr)~ get_node_text(node, bufnr)~
Returns the text content of a `node`. Returns the text content of a `node`.
*ts_utils.is_parent* *ts_utils.is_parent*
is_parent(dest, source)~ is_parent(dest, source)~
Determines whether `dest` is a parent of `source`. Determines whether `dest` is a parent of `source`.
Returns a boolean. Returns a boolean.
*ts_utils.get_named_children* *ts_utils.get_named_children*
get_named_children(node)~ get_named_children(node)~
Returns a table of named children of `node`. Returns a table of named children of `node`.
*ts_utils.get_next_node* *ts_utils.get_next_node*
get_next_node(node, allow_switch_parent, allow_next_parent)~ get_next_node(node, allow_switch_parent, allow_next_parent)~
Returns the next node within the same parent. Returns the next node within the same parent.
@ -337,14 +323,14 @@ when the node is the last node.
If `allow_next_parent` is true, it will allow next parent if If `allow_next_parent` is true, it will allow next parent if
the node is the last node and the next parent doesn't have children. the node is the last node and the next parent doesn't have children.
*ts_utils.get_previous_node* *ts_utils.get_previous_node*
get_previous_node(node, allow_switch_parents, allow_prev_parent)~ get_previous_node(node, allow_switch_parents, allow_prev_parent)~
Returns the previous node within the same parent. Returns the previous node within the same parent.
`allow_switch_parent` and `allow_prev_parent` follow the same rule `allow_switch_parent` and `allow_prev_parent` follow the same rule
as |ts_utils.get_next_node| but if the node is the first node. as |ts_utils.get_next_node| but if the node is the first node.
*ts_utils.goto_node* *ts_utils.goto_node*
goto_node(node, goto_end, avoid_set_jump)~ goto_node(node, goto_end, avoid_set_jump)~
Sets cursor to the position of `node` in the current windows. Sets cursor to the position of `node` in the current windows.
@ -352,13 +338,13 @@ If `goto_end` is truthy, the cursor is set to the end the node range.
Setting `avoid_set_jump` to `true`, avoids setting the current cursor position Setting `avoid_set_jump` to `true`, avoids setting the current cursor position
to the jump list. to the jump list.
*ts_utils.swap_nodes* *ts_utils.swap_nodes*
swap_nodes(node_or_range1, node_or_range2, bufnr, cursor_to_second)~ swap_nodes(node_or_range1, node_or_range2, bufnr, cursor_to_second)~
Swaps the nodes or ranges. Swaps the nodes or ranges.
set `cursor_to_second` to true to move the cursor to the second node set `cursor_to_second` to true to move the cursor to the second node
*ts_utils.memoize_by_buf_tick* *ts_utils.memoize_by_buf_tick*
memoize_by_buf_tick(fn, options)~ memoize_by_buf_tick(fn, options)~
Caches the return value for a function and returns the cache value if the tick Caches the return value for a function and returns the cache value if the tick
@ -372,22 +358,22 @@ of the buffer has not changed from the previous.
`returns`: a function to call with bufnr as argument to `returns`: a function to call with bufnr as argument to
retrieve the value from the cache retrieve the value from the cache
*ts_utils.node_to_lsp_range* *ts_utils.node_to_lsp_range*
node_to_lsp_range(node)~ node_to_lsp_range(node)~
Get an lsp formatted range from a node range Get an lsp formatted range from a node range
*ts_utils.get_node_range* *ts_utils.get_node_range*
get_node_range(node_or_range)~ get_node_range(node_or_range)~
Get the range from either a node or a range Get the range from either a node or a range
*ts_utils.node_length* *ts_utils.node_length*
node_length(node)~ node_length(node)~
Get the byte length of node range Get the byte length of node range
*ts_utils.update_selection* *ts_utils.update_selection*
update_selection(buf, node)~ update_selection(buf, node)~
Set the selection to the node range Set the selection to the node range
@ -397,7 +383,7 @@ highlight_range(range, buf, hl_namespace, hl_group)~
Set a highlight that spans the given range Set a highlight that spans the given range
*ts_utils.highlight_node* *ts_utils.highlight_node*
highlight_node(node, buf, hl_namespace, hl_group)~ highlight_node(node, buf, hl_namespace, hl_group)~
Set a highlight that spans the given node's range Set a highlight that spans the given node's range
@ -405,7 +391,7 @@ Set a highlight that spans the given node's range
============================================================================== ==============================================================================
FUNCTIONS *nvim-treesitter-functions* FUNCTIONS *nvim-treesitter-functions*
*nvim_treesitter#statusline()* *nvim_treesitter#statusline()*
nvim_treesitter#statusline(opts)~ nvim_treesitter#statusline(opts)~
Returns a string describing the current position in the file. This Returns a string describing the current position in the file. This
@ -426,7 +412,7 @@ Default options (lua syntax):
default removes opening brackets and spaces from end. default removes opening brackets and spaces from end.
- `separator` - Separator between nodes. - `separator` - Separator between nodes.
*nvim_treesitter#foldexpr()* *nvim_treesitter#foldexpr()*
nvim_treesitter#foldexpr()~ nvim_treesitter#foldexpr()~
Functions to be used to determine the fold level at a given line number. Functions to be used to determine the fold level at a given line number.
@ -444,224 +430,223 @@ Note: This is highly experimental, and folding can break on some types of
============================================================================== ==============================================================================
HIGHLIGHTS *nvim-treesitter-highlights* HIGHLIGHTS *nvim-treesitter-highlights*
*hl-TSAnnotation*
`TSAnnotation` `TSAnnotation`
*hl-TSAnnotation*
For C++/Dart attributes, annotations that can be attached to the code to For C++/Dart attributes, annotations that can be attached to the code to
denote some kind of meta information. denote some kind of meta information.
*hl-TSAttribute*
`TSAttribute` `TSAttribute`
hl-TSAttribute
(unstable) TODO: docs (unstable) TODO: docs
*hl-TSBoolean*
`TSBoolean` `TSBoolean`
*hl-TSBoolean*
For booleans. For booleans.
*hl-TSCharacter*
`TSCharacter` `TSCharacter`
*hl-TSCharacter*
For characters. For characters.
*hl-TSComment*
`TSComment` `TSComment`
*hl-TSComment*
For comment blocks. For comment blocks.
*hl-TSConstructor*
`TSConstructor` `TSConstructor`
*hl-TSConstructor*
For constructor calls and definitions: `{}` in Lua, and Java constructors. For constructor calls and definitions: `{}` in Lua, and Java constructors.
*hl-TSConditional*
`TSConditional` `TSConditional`
*hl-TSConditional*
For keywords related to conditionnals. For keywords related to conditionnals.
*hl-TSConstant*
`TSConstant` `TSConstant`
*hl-TSConstant*
For constants For constants
*hl-TSConstBuiltin*
`TSConstBuiltin` `TSConstBuiltin`
*hl-TSConstBuiltin*
For constant that are built in the language: `nil` in Lua. For constant that are built in the language: `nil` in Lua.
*hl-TSConstMacro*
`TSConstMacro` `TSConstMacro`
*hl-TSConstMacro*
For constants that are defined by macros: `NULL` in C. For constants that are defined by macros: `NULL` in C.
*hl-TSError*
`TSError` `TSError`
*hl-TSError*
For syntax/parser errors. For syntax/parser errors.
*hl-TSException*
`TSException` `TSException`
*hl-TSException*
For exception related keywords. For exception related keywords.
*hl-TSField*
`TSField` `TSField`
*hl-TSField*
For fields. For fields.
*hl-TSFloat*
`TSFloat` `TSFloat`
*hl-TSFloat*
For floats. For floats.
*hl-TSFunction*
`TSFunction` `TSFunction`
*hl-TSFunction*
For function (calls and definitions). For function (calls and definitions).
*hl-TSFuncBuiltin*
`TSFuncBuiltin` `TSFuncBuiltin`
*hl-TSFuncBuiltin*
For builtin functions: `table.insert` in Lua. For builtin functions: `table.insert` in Lua.
*hl-TSFuncMacro*
`TSFuncMacro` `TSFuncMacro`
*hl-TSFuncMacro*
For macro defined fuctions (calls and definitions): each `macro_rules` in For macro defined fuctions (calls and definitions): each `macro_rules` in
Rust. Rust.
*hl-TSInclude*
`TSInclude` `TSInclude`
*hl-TSInclude*
For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` For includes: `#include` in C, `use` or `extern crate` in Rust, or `require`
in Lua. in Lua.
*hl-TSKeyword*
`TSKeyword` `TSKeyword`
*hl-TSKeyword*
For keywords that don't fall in previous categories. For keywords that don't fall in previous categories.
*hl-TSKeywordFunction*
`TSKeywordFunction` `TSKeywordFunction`
*hl-TSKeywordFunction*
For keywords used to define a fuction. For keywords used to define a fuction.
*hl-TSLabel*
`TSLabel` `TSLabel`
*hl-TSLabel*
For labels: `label:` in C and `:label:` in Lua. For labels: `label:` in C and `:label:` in Lua.
*hl-TSMethod*
`TSMethod` `TSMethod`
*hl-TSMethod*
For method calls and definitions. For method calls and definitions.
*hl-TSNamespace*
`TSNamespace` `TSNamespace`
*hl-TSNamespace*
For identifiers referring to modules and namespaces. For identifiers referring to modules and namespaces.
*hl-None*
`TSNone` `TSNone`
*hl-None*
TODO: docs TODO: docs
*hl-TSNumber*
`TSNumber` `TSNumber`
*hl-TSNumber*
For all numbers For all numbers
*hl-TSOperator*
`TSOperator` `TSOperator`
*hl-TSOperator*
For any operator: `+`, but also `->` and `*` in C. For any operator: `+`, but also `->` and `*` in C.
*hl-TSParameter*
`TSParameter` `TSParameter`
*hl-TSParameter*
For parameters of a function. For parameters of a function.
*hl-TSParameterReference*
`TSParameterReference` `TSParameterReference`
*hl-TSParameterReference*
For references to parameters of a function. For references to parameters of a function.
*hl-TSProperty*
`TSProperty` `TSProperty`
*hl-TSProperty*
Same as `TSField`. Same as `TSField`.
*hl-TSPunctDelimiter*
`TSPunctDelimiter` `TSPunctDelimiter`
*hl-TSPunctDelimiter*
For delimiters ie: `.` For delimiters ie: `.`
*hl-TSPunctBracket*
`TSPunctBracket` `TSPunctBracket`
*hl-TSPunctBracket*
For brackets and parens. For brackets and parens.
*hl-TSPunctSpecial*
`TSPunctSpecial` `TSPunctSpecial`
*hl-TSPunctSpecial*
For special punctutation that does not fall in the catagories before. For special punctutation that does not fall in the catagories before.
*hl-TSRepeat*
`TSRepeat` `TSRepeat`
*hl-TSRepeat*
For keywords related to loops. For keywords related to loops.
*hl-TSString*
`TSString` `TSString`
*hl-TSString*
For strings. For strings.
*hl-TSStringRegex*
`TSStringRegex` `TSStringRegex`
*hl-TSStringRegex*
For regexes. For regexes.
*hl-TSStringEscape*
`TSStringEscape` `TSStringEscape`
*hl-TSStringEscape*
For escape characters within a string. For escape characters within a string.
*hl-TSSymbol*
`TSSymbol` `TSSymbol`
*hl-TSSymbol*
For identifiers referring to symbols or atoms. For identifiers referring to symbols or atoms.
*hl-TSTag*
`TSTag` `TSTag`
*hl-TSTag*
Tags like html tag names. Tags like html tag names.
*hl-TSTagDelimiter*
`TSTagDelimiter` `TSTagDelimiter`
*hl-TSTagDelimiter*
Tag delimiter like `<` `>` `/` Tag delimiter like `<` `>` `/`
*hl-TSText*
`TSText` `TSText`
*hl-TSText*
For strings considered text in a markup language. For strings considered text in a markup language.
*hl-TSSTrong*
`TSStrong` `TSStrong`
*hl-TSSTrong*
For text to be represented in bold. For text to be represented in bold.
*hl-TSEmphasis*
`TSEmphasis` `TSEmphasis`
*hl-TSEmphasis*
For text to be represented with emphasis. For text to be represented with emphasis.
*hl-TSUnderline*
`TSUnderline` `TSUnderline`
*hl-TSUnderline*
For text to be represented with an underline. For text to be represented with an underline.
`TSStrike`
*hl-TSStrike* *hl-TSStrike*
`TSStrike`
For strikethrough text. For strikethrough text.
*hl-TSTitle*
`TSTitle` `TSTitle`
*hl-TSTitle*
Text that is part of a title. Text that is part of a title.
*hl-TSLiteral*
`TSLiteral` `TSLiteral`
*hl-TSLiteral*
Literal text. Literal text.
*hl-TSURI*
`TSURI` `TSURI`
*hl-TSURI*
Any URI like a link or email. Any URI like a link or email.
*hl-TSNote*
`TSNote` `TSNote`
*hl-TSNote*
Text representation of an informational note. Text representation of an informational note.
*TSWarning*
`TSWarning` `TSWarning`
*TSWarning*
Text representation of a warning note. Text representation of a warning note.
*TSDanger*
`TSDanger` `TSDanger`
*TSDanger*
Text representation of a danger note. Text representation of a danger note.
*hl-TSType*
`TSType` `TSType`
*hl-TSType*
For types. For types.
*hl-TSTypeBuiltin*
`TSTypeBuiltin` `TSTypeBuiltin`
*hl-TSTypeBuiltin*
For builtin types. For builtin types.
*hl-TSVariable*
`TSVariable` `TSVariable`
*hl-TSVariable*
Any variable name that does not have another highlight. Any variable name that does not have another highlight.
*hl-TSVariableBuiltin*
`TSVariableBuiltin` `TSVariableBuiltin`
*hl-TSVariableBuiltin*
Variable names that are defined by the languages, like `this` or `self`. Variable names that are defined by the languages, like `this` or `self`.
============================================================================== ==============================================================================