aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel S Poulin2022-03-08 05:02:03 +0000
committerGitHub2022-03-08 05:02:03 +0000
commit24352b2729559533948da92098529e59cd6562fd (patch)
tree306f9f52690b9421faa782b994a0ab51b1e3ada3
parentbde0307c8795d521dce4be849f38bc1808f1b9a2 (diff)
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
-rw-r--r--book/src/keymap.md56
-rw-r--r--helix-term/src/keymap.rs8
2 files changed, 32 insertions, 32 deletions
diff --git a/book/src/keymap.md b/book/src/keymap.md
index f9e0824e..77fa6154 100644
--- a/book/src/keymap.md
+++ b/book/src/keymap.md
@@ -95,34 +95,34 @@
### Selection manipulation
-| Key | Description | Command |
-| ----- | ----------- | ------- |
-| `s` | Select all regex matches inside selections | `select_regex` |
-| `S` | Split selection into subselections on regex matches | `split_selection` |
-| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
-| `&` | Align selection in columns | `align_selections` |
-| `_` | Trim whitespace from the selection | `trim_selections` |
-| `;` | Collapse selection onto a single cursor | `collapse_selection` |
-| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
-| `,` | Keep only the primary selection | `keep_primary_selection` |
-| `Alt-,` | Remove the primary selection | `remove_primary_selection` |
-| `C` | Copy selection onto the next line (Add cursor below) | `copy_selection_on_next_line` |
-| `Alt-C` | Copy selection onto the previous line (Add cursor above) | `copy_selection_on_prev_line` |
-| `(` | Rotate main selection backward | `rotate_selections_backward` |
-| `)` | Rotate main selection forward | `rotate_selections_forward` |
-| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
-| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
-| `%` | Select entire file | `select_all` |
-| `x` | Select current line, if already selected, extend to next line | `extend_line` |
-| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
-| `J` | Join lines inside selection | `join_selections` |
-| `K` | Keep selections matching the regex | `keep_selections` |
-| `Alt-K` | Remove selections matching the regex | `remove_selections` |
-| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
-| `Alt-k` | Expand selection to parent syntax node (**TS**) | `expand_selection` |
-| `Alt-j` | Shrink syntax tree object selection (**TS**) | `shrink_selection` |
-| `Alt-h` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
-| `Alt-l` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
+| Key | Description | Command |
+| ----- | ----------- | ------- |
+| `s` | Select all regex matches inside selections | `select_regex` |
+| `S` | Split selection into subselections on regex matches | `split_selection` |
+| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
+| `&` | Align selection in columns | `align_selections` |
+| `_` | Trim whitespace from the selection | `trim_selections` |
+| `;` | Collapse selection onto a single cursor | `collapse_selection` |
+| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
+| `,` | Keep only the primary selection | `keep_primary_selection` |
+| `Alt-,` | Remove the primary selection | `remove_primary_selection` |
+| `C` | Copy selection onto the next line (Add cursor below) | `copy_selection_on_next_line` |
+| `Alt-C` | Copy selection onto the previous line (Add cursor above) | `copy_selection_on_prev_line` |
+| `(` | Rotate main selection backward | `rotate_selections_backward` |
+| `)` | Rotate main selection forward | `rotate_selections_forward` |
+| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
+| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
+| `%` | Select entire file | `select_all` |
+| `x` | Select current line, if already selected, extend to next line | `extend_line` |
+| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
+| `J` | Join lines inside selection | `join_selections` |
+| `K` | Keep selections matching the regex | `keep_selections` |
+| `Alt-K` | Remove selections matching the regex | `remove_selections` |
+| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
+| `Alt-k`/`Alt-up` | Expand selection to parent syntax node (**TS**) | `expand_selection` |
+| `Alt-j`/`Alt-down` | Shrink syntax tree object selection (**TS**) | `shrink_selection` |
+| `Alt-h`/`Alt-left` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
+| `Alt-l`/`Alt-right` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
### Search
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index a203b4e2..1fe1f633 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -584,10 +584,10 @@ impl Default for Keymaps {
"S" => split_selection,
";" => collapse_selection,
"A-;" => flip_selections,
- "A-k" => expand_selection,
- "A-j" => shrink_selection,
- "A-h" => select_prev_sibling,
- "A-l" => select_next_sibling,
+ "A-k" | "A-up" => expand_selection,
+ "A-j" | "A-down" => shrink_selection,
+ "A-h" | "A-left" => select_prev_sibling,
+ "A-l" | "A-right" => select_next_sibling,
"%" => select_all,
"x" => extend_line,