*nvim-treesitter-textobjects* Syntax aware |text-objects|, select, move, swap, and peek support. Type |gO| to see the table of contents. ============================================================================== MODULES *nvim-treesitter-textobjects-modules* Available modules for |nvim-treesitter|. ------------------------------------------------------------------------------ *nvim-treesitter-text-objects-select-submod* Text object selection~ Define your own text objects mappings similar to `ip` (inner paragraph) and `ap` (a paragraph). Query files: `textobjects.scm`. Supported options: - enable: `true` or `false`. - disable: list of languages. - lookahead: `true` or `false`, whether or not to look ahead for the textobject - keymaps: map of keymaps to a tree-sitter query (`(function_definition) @function`) or capture group (`@function.inner`). - selection_modes: map of capture group to `v`(charwise), `V`(linewise), or ``(blockwise), choose a selection mode per capture, default is `v`(charwise). - include_surrounding_whitespace: `true` or `false`, when `true` textobjects are extended to include preceding or succeeding whitespace, defaults is `false`. Can also be a function which gets passed a table with the keys `query_string` (`@function.inner`) and `selection_mode` (`v`) and returns `true` of `false`. > lua < lua <a"] = "@parameter.inner", }, swap_previous = { ["A"] = "@parameter.inner", }, }, }, } EOF < ------------------------------------------------------------------------------ *nvim-treesitter-text-objects-move-submod* Go to next/previous text object~ Define your own mappings to jump to the next or previous text object. This is similar to |]m|, |[m|, |]M|, |[M| Neovim's mappings to jump to the next or previous function. Query files: `textobjects.scm`. Supported options: - enable: `true` or `false`. - disable: list of languages. - set_jumps: whether to set jumps in the jumplist - goto_next_start: map of keymaps to a list of tree-sitter capture groups (`{@function.outer, @class.outer}`). The one that starts closest to the cursor will be chosen, preferring row-proximity to column-proximity. - goto_next_end: same as goto_next_start, but it jumps to the end of the text object. - goto_previous_start: same as goto_next_start, but it jumps to the previous text object. - goto_previous_end: same as goto_next_end, but it jumps to the previous text object. > lua < lua <df"] = "@function.outer", ["dF"] = "@class.outer", }, }, }, } EOF < ------------------------------------------------------------------------------ *nvim-treesitter-text-objects-override* Overrriding or extending text objects~ Textobjects are defined in the `textobjects.scm` files. You can extend or override those files by following the instructions at . You can also use a custom capture for your own textobjects, and use it in any of the textobject modules, for example: > lua < ```scm -- after/queries/python/textobjects.scm (function_definition) @custom-capture ``` < vim:tw=78:ts=8:expandtab:noet:ft=help:norl: