Skip to content

Commit

Permalink
setup Alt-{j,k,h,l} default keymaps for syntax selection commands
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Jan 16, 2022
1 parent 5549acd commit a0d0129
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions book/src/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
| `Alt-K` | Remove selections matching the regex | `remove_selections` |
| `$` | Pipe each selection into shell command, keep selections where command returned 0 | `shell_keep_pipe` |
| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
| `Alt-k` | Expand selection to parent syntax node | `expand_selection` |
| `Alt-j` | Shrink syntax tree object selection | `shrink_selection` |
| `Alt-h` | Shrink previous sibling node in syntax tree | `select_prev_sibling` |
| `Alt-l` | Shrink next sibling node in syntax tree | `select_next_sibling` |

### Search

Expand Down Expand Up @@ -261,8 +265,6 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire
| `]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` |
| `]o` | Expand syntax tree object selection. | `expand_selection` |
| `[o` | Shrink syntax tree object selection. | `shrink_selection` |

## Insert Mode

Expand Down
9 changes: 5 additions & 4 deletions helix-term/src/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ impl Default for Keymaps {
"S" => split_selection,
";" => collapse_selection,
"A-;" => flip_selections,
"A-k" => expand_selection,
"A-j" => shrink_selection,
"A-h" => select_next_sibling,
"A-l" => select_prev_sibling,

"%" => select_all,
"x" => extend_line,
"X" => extend_to_line_bounds,
Expand All @@ -569,15 +574,11 @@ impl Default for Keymaps {
"d" => goto_prev_diag,
"D" => goto_first_diag,
"space" => add_newline_above,
"o" => shrink_selection,
"t" => select_prev_sibling,
},
"]" => { "Right bracket"
"d" => goto_next_diag,
"D" => goto_last_diag,
"space" => add_newline_below,
"o" => expand_selection,
"t" => select_next_sibling,
},

"/" => search,
Expand Down

0 comments on commit a0d0129

Please sign in to comment.