on master help sign in
Add docs for tree-sitter based navigation
commit989407f190d543154e33630b07f4a53d13798d72 authorGokul Soumya <gokulps15@gmail.com> dateThu 3 Feb 2022, 16:38 (5 years ago) parent966fbc5
2 files changed+36−11
book/src/keymap.md+14−8 book/src/usage.md+22−3
book/src/keymap.md+14−8
@@ -258,14 +258,20 @@ Displays documentation for item under cursor.
258258
259259Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
260260
261−| Key | Description | Command |
262−| ----- | ----------- | ------- |
263−| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
264−| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
265−| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
266−| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
267−| `[space` | Add newline above | `add_newline_above` |
268−| `]space` | Add newline below | `add_newline_below` |
261+| Key | Description | Command |
262+| ----- | ----------- | ------- |
263+| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
264+| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
265+| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
266+| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
267+| `]f` | Go to next function (**TS**) | `goto_next_function` |
268+| `[f` | Go to previous function (**TS**) | `goto_prev_function` |
269+| `]c` | Go to next class (**TS**) | `goto_next_class` |
270+| `[c` | Go to previous class (**TS**) | `goto_prev_class` |
271+| `]p` | Go to next parameter (**TS**) | `goto_next_parameter` |
272+| `[p` | Go to previous parameter (**TS**) | `goto_prev_parameter` |
273+| `[space` | Add newline above | `add_newline_above` |
274+| `]space` | Add newline below | `add_newline_below` |
269275
270276## Insert Mode
271277
book/src/usage.md+22−3
@@ -70,7 +70,26 @@ Currently supported: `word`, `surround`, `function`, `class`, `parameter`.
7070| `c` | Class |
7171| `p` | Parameter |
7272
73−Note: `f`, `c`, etc need a tree-sitter grammar active for the current
73+> NOTE: `f`, `c`, etc need a tree-sitter grammar active for the current
7474document and a special tree-sitter query file to work properly. [Only
75−some grammars](https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l=)
76−currently have the query file implemented. Contributions are welcome !
75+some grammars][lang-support] currently have the query file implemented.
76+Contributions are welcome!
77+
78+## Tree-sitter Based Navigation
79+
80+Navigating between functions, classes, parameters, etc is made
81+possible by leveraging tree-sitter and textobjects queries. For
82+example to move to the next function use `]f`, to move to previous
83+class use `[c`, and so on.
84+
85+![tree-sitter-nav-demo][tree-sitter-nav-demo]
86+
87+See the [unimpaired][unimpaired-keybinds] section of the keybind
88+documentation for the full reference.
89+
90+> NOTE: This feature is dependent on tree-sitter based textobjects
91+and therefore requires the corresponding query file to work properly.
92+
93+[lang-support]: ./lang-support.md
94+[unimpaired-keybinds]: ./keymap.md#unimpaired
95+[tree-sitter-nav-demo]: https://user-images.githubusercontent.com/23398472/152332550-7dfff043-36a2-4aec-b8f2-77c13eb56d6f.gif