Add docs for tree-sitter based navigation
This commit is contained in:
parent
966fbc5984
commit
989407f190
2 changed files with 36 additions and 11 deletions
|
@ -258,14 +258,20 @@ Displays documentation for item under cursor.
|
||||||
|
|
||||||
Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
|
Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
|
||||||
|
|
||||||
| Key | Description | Command |
|
| Key | Description | Command |
|
||||||
| ----- | ----------- | ------- |
|
| ----- | ----------- | ------- |
|
||||||
| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
|
| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
|
||||||
| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
|
| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
|
||||||
| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
|
| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
|
||||||
| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
|
| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
|
||||||
| `[space` | Add newline above | `add_newline_above` |
|
| `]f` | Go to next function (**TS**) | `goto_next_function` |
|
||||||
| `]space` | Add newline below | `add_newline_below` |
|
| `[f` | Go to previous function (**TS**) | `goto_prev_function` |
|
||||||
|
| `]c` | Go to next class (**TS**) | `goto_next_class` |
|
||||||
|
| `[c` | Go to previous class (**TS**) | `goto_prev_class` |
|
||||||
|
| `]p` | Go to next parameter (**TS**) | `goto_next_parameter` |
|
||||||
|
| `[p` | Go to previous parameter (**TS**) | `goto_prev_parameter` |
|
||||||
|
| `[space` | Add newline above | `add_newline_above` |
|
||||||
|
| `]space` | Add newline below | `add_newline_below` |
|
||||||
|
|
||||||
## Insert Mode
|
## Insert Mode
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,26 @@ Currently supported: `word`, `surround`, `function`, `class`, `parameter`.
|
||||||
| `c` | Class |
|
| `c` | Class |
|
||||||
| `p` | Parameter |
|
| `p` | Parameter |
|
||||||
|
|
||||||
Note: `f`, `c`, etc need a tree-sitter grammar active for the current
|
> 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
|
document and a special tree-sitter query file to work properly. [Only
|
||||||
some grammars](https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l=)
|
some grammars][lang-support] currently have the query file implemented.
|
||||||
currently have the query file implemented. Contributions are welcome !
|
Contributions are welcome!
|
||||||
|
|
||||||
|
## Tree-sitter 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][tree-sitter-nav-demo]
|
||||||
|
|
||||||
|
See the [unimpaired][unimpaired-keybinds] 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.
|
||||||
|
|
||||||
|
[lang-support]: ./lang-support.md
|
||||||
|
[unimpaired-keybinds]: ./keymap.md#unimpaired
|
||||||
|
[tree-sitter-nav-demo]: https://user-images.githubusercontent.com/23398472/152332550-7dfff043-36a2-4aec-b8f2-77c13eb56d6f.gif
|
||||||
|
|
Loading…
Add table
Reference in a new issue