summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGokul Soumya2022-02-03 11:08:03 +0000
committerBlaž Hrastnik2022-02-15 05:04:46 +0000
commit989407f190d543154e33630b07f4a53d13798d72 (patch)
treeda779a7f7d32d1bbf8f4cc5a043c86c78dacf26c
parent966fbc59849701dc56f70af406444c351bc9f54a (diff)
Add docs for tree-sitter based navigation
-rw-r--r--book/src/keymap.md22
-rw-r--r--book/src/usage.md25
2 files changed, 36 insertions, 11 deletions
diff --git a/book/src/keymap.md b/book/src/keymap.md
index b135a9f5..5de4edf9 100644
--- a/book/src/keymap.md
+++ b/book/src/keymap.md
@@ -258,14 +258,20 @@ Displays documentation for item under cursor.
Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
-| Key | Description | Command |
-| ----- | ----------- | ------- |
-| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
-| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
-| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
-| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
-| `[space` | Add newline above | `add_newline_above` |
-| `]space` | Add newline below | `add_newline_below` |
+| Key | Description | Command |
+| ----- | ----------- | ------- |
+| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
+| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
+| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
+| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
+| `]f` | Go to next function (**TS**) | `goto_next_function` |
+| `[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
diff --git a/book/src/usage.md b/book/src/usage.md
index a76bfafc..3f9499ca 100644
--- a/book/src/usage.md
+++ b/book/src/usage.md
@@ -70,7 +70,26 @@ Currently supported: `word`, `surround`, `function`, `class`, `parameter`.
| `c` | Class |
| `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
-some grammars](https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l=)
-currently have the query file implemented. Contributions are welcome !
+some grammars][lang-support] currently have the query file implemented.
+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