mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
Document textobjects support
This is really just a quick draft; I figure it's better to have something short and a link to the full reference than nothing at all.
This commit is contained in:
parent
0e21ee8df6
commit
cbd3703c6b
1 changed files with 22 additions and 1 deletions
23
README.md
23
README.md
|
|
@ -98,7 +98,7 @@ To make sure a parser is at the latest compatible version (as specified in `nvim
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
Each module provides a distinct tree-sitter-based feature such as [highlighting](#highlight), [indentation](#indentation), or [folding](#folding); see [`:h nvim-treesitter-modules`](doc/nvim-treesitter.txt) or ["Available modules"](#available-modules) below for a list of modules and their options.
|
Each module provides a distinct tree-sitter-based feature such as [highlighting](#highlight), [indentation](#indentation), [textobjects](#text-objects), or [folding](#folding); see [`:h nvim-treesitter-modules`](doc/nvim-treesitter.txt) or ["Available modules"](#available-modules) below for a list of modules and their options.
|
||||||
|
|
||||||
Following examples assume that you are configuring neovim with lua. If you are using vimscript, see `:h lua-heredoc`.
|
Following examples assume that you are configuring neovim with lua. If you are using vimscript, see `:h lua-heredoc`.
|
||||||
All modules are disabled by default and need to be activated explicitly in your `init.lua`, e.g., via
|
All modules are disabled by default and need to be activated explicitly in your `init.lua`, e.g., via
|
||||||
|
|
@ -566,6 +566,27 @@ require'nvim-treesitter.configs'.setup {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Text objects
|
||||||
|
|
||||||
|
Neovim `:text-objects` integration. This is provided by <https://github.com/nvim-treesitter/nvim-treesitter-textobjects>.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See <https://github.com/nvim-treesitter/nvim-treesitter-textobjects#built-in-textobjects> for a complete list of possible textobjects.
|
||||||
|
|
||||||
|
|
||||||
#### Folding
|
#### Folding
|
||||||
|
|
||||||
Tree-sitter based folding (implemented in Neovim itself, see `:h vim.treesitter.foldexpr()`). To enable it for the current window, set
|
Tree-sitter based folding (implemented in Neovim itself, see `:h vim.treesitter.foldexpr()`). To enable it for the current window, set
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue