on master help sign in
Change default TS object bindings (#3782)

* Change default TS object bindings Changes 'match inside/around' bindings for: - type definition from `c` to `t` - comments from `o` to `c` - tests from `t` to `T` Also changes those for the `]` / `[` bindings. * Update docs for changed keybinds Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

commit7210c58a51a16c0ae3c9d77211ed1a25e039bd9e authornosa <96927121+n0s4@users.noreply.github.com> dateTue 6 Dec 2022, 01:13 (4 years ago) parent5691ada
3 files changed+21−21
book/src/keymap.md+7−7 helix-term/src/commands.rs+8−8 helix-term/src/keymap/default.rs+6−6
book/src/keymap.md+7−7
@@ -297,7 +297,7 @@ Displays documentation for item under cursor.
297297| ---- | ----------- |
298298| `Ctrl-u` | Scroll up |
299299| `Ctrl-d` | Scroll down |
300−
300+
301301#### Unimpaired
302302
303303Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
@@ -310,14 +310,14 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire
310310| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
311311| `]f` | Go to next function (**TS**) | `goto_next_function` |
312312| `[f` | Go to previous function (**TS**) | `goto_prev_function` |
313−| `]c` | Go to next class (**TS**) | `goto_next_class` |
314−| `[c` | Go to previous class (**TS**) | `goto_prev_class` |
313+| `]t` | Go to next type definition (**TS**) | `goto_next_class` |
314+| `[t` | Go to previous type definition (**TS**) | `goto_prev_class` |
315315| `]a` | Go to next argument/parameter (**TS**) | `goto_next_parameter` |
316316| `[a` | Go to previous argument/parameter (**TS**) | `goto_prev_parameter` |
317−| `]o` | Go to next comment (**TS**) | `goto_next_comment` |
318−| `[o` | Go to previous comment (**TS**) | `goto_prev_comment` |
319−| `]t` | Go to next test (**TS**) | `goto_next_test` |
320−| `]t` | Go to previous test (**TS**) | `goto_prev_test` |
317+| `]c` | Go to next comment (**TS**) | `goto_next_comment` |
318+| `[c` | Go to previous comment (**TS**) | `goto_prev_comment` |
319+| `]T` | Go to next test (**TS**) | `goto_next_test` |
320+| `]T` | Go to previous test (**TS**) | `goto_prev_test` |
321321| `]p` | Go to next paragraph | `goto_next_paragraph` |
322322| `[p` | Go to previous paragraph | `goto_prev_paragraph` |
323323| `[Space` | Add newline above | `add_newline_above` |
helix-term/src/commands.rs+8−8
@@ -402,8 +402,8 @@ impl MappableCommand {
402402 select_textobject_inner, "Select inside object",
403403 goto_next_function, "Goto next function",
404404 goto_prev_function, "Goto previous function",
405− goto_next_class, "Goto next class",
406− goto_prev_class, "Goto previous class",
405+ goto_next_class, "Goto next type definition",
406+ goto_prev_class, "Goto previous type definition",
407407 goto_next_parameter, "Goto next parameter",
408408 goto_prev_parameter, "Goto previous parameter",
409409 goto_next_comment, "Goto next comment",
@@ -4520,11 +4520,11 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) {
45204520 match ch {
45214521 'w' => textobject::textobject_word(text, range, objtype, count, false),
45224522 'W' => textobject::textobject_word(text, range, objtype, count, true),
4523− 'c' => textobject_treesitter("class", range),
4523+ 't' => textobject_treesitter("class", range),
45244524 'f' => textobject_treesitter("function", range),
45254525 'a' => textobject_treesitter("parameter", range),
4526− 'o' => textobject_treesitter("comment", range),
4527− 't' => textobject_treesitter("test", range),
4526+ 'c' => textobject_treesitter("comment", range),
4527+ 'T' => textobject_treesitter("test", range),
45284528 'p' => textobject::textobject_paragraph(text, range, objtype, count),
45294529 'm' => textobject::textobject_pair_surround_closest(
45304530 text, range, objtype, count,
@@ -4552,11 +4552,11 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) {
45524552 ("w", "Word"),
45534553 ("W", "WORD"),
45544554 ("p", "Paragraph"),
4555− ("c", "Class (tree-sitter)"),
4555+ ("t", "Type definition (tree-sitter)"),
45564556 ("f", "Function (tree-sitter)"),
45574557 ("a", "Argument/parameter (tree-sitter)"),
4558− ("o", "Comment (tree-sitter)"),
4559− ("t", "Test (tree-sitter)"),
4558+ ("c", "Comment (tree-sitter)"),
4559+ ("T", "Test (tree-sitter)"),
45604560 ("m", "Closest surrounding pair to cursor"),
45614561 (" ", "... or any character acting as a pair"),
45624562 ];
helix-term/src/keymap/default.rs+6−6
@@ -101,10 +101,10 @@ pub fn default() -> HashMap<Mode, Keymap> {
101101 "d" => goto_prev_diag,
102102 "D" => goto_first_diag,
103103 "f" => goto_prev_function,
104− "c" => goto_prev_class,
104+ "t" => goto_prev_class,
105105 "a" => goto_prev_parameter,
106− "o" => goto_prev_comment,
107− "t" => goto_prev_test,
106+ "c" => goto_prev_comment,
107+ "T" => goto_prev_test,
108108 "p" => goto_prev_paragraph,
109109 "space" => add_newline_above,
110110 },
@@ -112,10 +112,10 @@ pub fn default() -> HashMap<Mode, Keymap> {
112112 "d" => goto_next_diag,
113113 "D" => goto_last_diag,
114114 "f" => goto_next_function,
115− "c" => goto_next_class,
115+ "t" => goto_next_class,
116116 "a" => goto_next_parameter,
117− "o" => goto_next_comment,
118− "t" => goto_next_test,
117+ "c" => goto_next_comment,
118+ "T" => goto_next_test,
119119 "p" => goto_next_paragraph,
120120 "space" => add_newline_below,
121121 },