diff --git a/guides/textobject.html b/guides/textobject.html index c5d323b9f..5377efe93 100644 --- a/guides/textobject.html +++ b/guides/textobject.html @@ -157,6 +157,18 @@ for example).

parameter.inside

Example query files can be found in the helix GitHub repository.

+

Queries for Textobject Based Navigation

+

Tree-sitter based navigation is done using captures in the +following order:

+ +

For example if a function.around capture has been already defined for a language +in it's textobjects.scm file, function navigation should also work automatically. +function.movement should be defined only if the node captured by function.around +doesn't make sense in a navigation context.

diff --git a/keymap.html b/keymap.html index e571faa6a..47102ac91 100644 --- a/keymap.html +++ b/keymap.html @@ -366,6 +366,12 @@ and textobject usage.

]dGo to next diagnostic (LSP)goto_next_diag [DGo to first diagnostic in document (LSP)goto_first_diag ]DGo to last diagnostic in document (LSP)goto_last_diag +]fGo to next function (TS)goto_next_function +[fGo to previous function (TS)goto_prev_function +]cGo to next class (TS)goto_next_class +[cGo to previous class (TS)goto_prev_class +]pGo to next parameter (TS)goto_next_parameter +[pGo to previous parameter (TS)goto_prev_parameter [spaceAdd newline aboveadd_newline_above ]spaceAdd newline belowadd_newline_below diff --git a/print.html b/print.html index b92d2acfb..d07a7ca2a 100644 --- a/print.html +++ b/print.html @@ -228,10 +228,24 @@ on the closest pairs found and selections are not required; use counts to act in cClass pParameter -

Note: f, c, etc need a tree-sitter grammar active for the current -document and a special tree-sitter query file to work properly. Only -some grammars -currently have the query file implemented. Contributions are welcome !

+
+

NOTE: f, c, etc need a tree-sitter grammar active for the current +document and a special tree-sitter query file to work properly. Only +some grammars currently have the query file implemented. +Contributions are welcome!

+
+

Tree-sitter Textobject Based Navigation

+

Navigating between functions, classes, parameters, etc is made +possible by leveraging tree-sitter and textobjects queries. For +example to move to the next function use ]f, to move to previous +class use [c, and so on.

+

tree-sitter-nav-demo

+

See the unimpaired section of the keybind +documentation for the full reference.

+
+

NOTE: This feature is dependent on tree-sitter based textobjects +and therefore requires the corresponding query file to work properly.

+

Keymap