on master help sign in
Add arrow key mappings for tree-sitter parent/child/sibling nav (#1724)

* Add arrow key mappings for tree-sitter parent/child/sibling nav This helps my use case, where I use a non-qwerty layout with a programmable mechanical keyboard, and use a layer switching key (think fn) to send left down up right from the traditional hjkl positions. * Add new bindings to docs

commit24352b2729559533948da92098529e59cd6562fd authorDaniel S Poulin <dan.poulin@digitalsurgeons.com> dateTue 8 Mar 2022, 00:02 (5 years ago) parentbde0307
2 files changed+32−32
book/src/keymap.md+28−28 helix-term/src/keymap.rs+4−4
book/src/keymap.md+28−28
@@ -95,34 +95,34 @@
9595
9696### Selection manipulation
9797
98−| Key | Description | Command |
99−| ----- | ----------- | ------- |
100−| `s` | Select all regex matches inside selections | `select_regex` |
101−| `S` | Split selection into subselections on regex matches | `split_selection` |
102−| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
103−| `&` | Align selection in columns | `align_selections` |
104−| `_` | Trim whitespace from the selection | `trim_selections` |
105−| `;` | Collapse selection onto a single cursor | `collapse_selection` |
106−| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
107−| `,` | Keep only the primary selection | `keep_primary_selection` |
108−| `Alt-,` | Remove the primary selection | `remove_primary_selection` |
109−| `C` | Copy selection onto the next line (Add cursor below) | `copy_selection_on_next_line` |
110−| `Alt-C` | Copy selection onto the previous line (Add cursor above) | `copy_selection_on_prev_line` |
111−| `(` | Rotate main selection backward | `rotate_selections_backward` |
112−| `)` | Rotate main selection forward | `rotate_selections_forward` |
113−| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
114−| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
115−| `%` | Select entire file | `select_all` |
116−| `x` | Select current line, if already selected, extend to next line | `extend_line` |
117−| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
118−| `J` | Join lines inside selection | `join_selections` |
119−| `K` | Keep selections matching the regex | `keep_selections` |
120−| `Alt-K` | Remove selections matching the regex | `remove_selections` |
121−| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
122−| `Alt-k` | Expand selection to parent syntax node (**TS**) | `expand_selection` |
123−| `Alt-j` | Shrink syntax tree object selection (**TS**) | `shrink_selection` |
124−| `Alt-h` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
125−| `Alt-l` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
98+| Key | Description | Command |
99+| ----- | ----------- | ------- |
100+| `s` | Select all regex matches inside selections | `select_regex` |
101+| `S` | Split selection into subselections on regex matches | `split_selection` |
102+| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
103+| `&` | Align selection in columns | `align_selections` |
104+| `_` | Trim whitespace from the selection | `trim_selections` |
105+| `;` | Collapse selection onto a single cursor | `collapse_selection` |
106+| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
107+| `,` | Keep only the primary selection | `keep_primary_selection` |
108+| `Alt-,` | Remove the primary selection | `remove_primary_selection` |
109+| `C` | Copy selection onto the next line (Add cursor below) | `copy_selection_on_next_line` |
110+| `Alt-C` | Copy selection onto the previous line (Add cursor above) | `copy_selection_on_prev_line` |
111+| `(` | Rotate main selection backward | `rotate_selections_backward` |
112+| `)` | Rotate main selection forward | `rotate_selections_forward` |
113+| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
114+| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
115+| `%` | Select entire file | `select_all` |
116+| `x` | Select current line, if already selected, extend to next line | `extend_line` |
117+| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
118+| `J` | Join lines inside selection | `join_selections` |
119+| `K` | Keep selections matching the regex | `keep_selections` |
120+| `Alt-K` | Remove selections matching the regex | `remove_selections` |
121+| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
122+| `Alt-k`/`Alt-up` | Expand selection to parent syntax node (**TS**) | `expand_selection` |
123+| `Alt-j`/`Alt-down` | Shrink syntax tree object selection (**TS**) | `shrink_selection` |
124+| `Alt-h`/`Alt-left` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
125+| `Alt-l`/`Alt-right` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
126126
127127### Search
128128
helix-term/src/keymap.rs+4−4
@@ -584,10 +584,10 @@ impl Default for Keymaps {
584584 "S" => split_selection,
585585 ";" => collapse_selection,
586586 "A-;" => flip_selections,
587− "A-k" => expand_selection,
588− "A-j" => shrink_selection,
589− "A-h" => select_prev_sibling,
590− "A-l" => select_next_sibling,
587+ "A-k" | "A-up" => expand_selection,
588+ "A-j" | "A-down" => shrink_selection,
589+ "A-h" | "A-left" => select_prev_sibling,
590+ "A-l" | "A-right" => select_next_sibling,
591591
592592 "%" => select_all,
593593 "x" => extend_line,