Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/static-cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
| `scroll_up` | Scroll view up | normal: `` Zk ``, `` zk ``, `` Z<up> ``, `` z<up> ``, select: `` Zk ``, `` zk ``, `` Z<up> ``, `` z<up> `` |
| `scroll_down` | Scroll view down | normal: `` Zj ``, `` zj ``, `` Z<down> ``, `` z<down> ``, select: `` Zj ``, `` zj ``, `` Z<down> ``, `` z<down> `` |
| `match_brackets` | Goto matching bracket | normal: `` mm ``, select: `` mm `` |
| `extend_brackets` | Extend to matching bracket | |
| `surround_add` | Surround add | normal: `` ms ``, select: `` ms `` |
| `surround_replace` | Surround replace | normal: `` mr ``, select: `` mr `` |
| `surround_delete` | Surround delete | normal: `` md ``, select: `` md `` |
Expand Down
13 changes: 10 additions & 3 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ impl MappableCommand {
scroll_up, "Scroll view up",
scroll_down, "Scroll view down",
match_brackets, "Goto matching bracket",
extend_brackets, "Extend to matching bracket",
surround_add, "Surround add",
surround_replace, "Surround replace",
surround_delete, "Surround delete",
Expand Down Expand Up @@ -5592,9 +5593,9 @@ fn select_all_children(cx: &mut Context) {
cx.editor.apply_motion(motion);
}

fn match_brackets(cx: &mut Context) {
fn match_brackets_impl(cx: &mut Context, movement: Movement) {
let (view, doc) = current!(cx.editor);
let is_select = cx.editor.mode == Mode::Select;
let is_select = movement == Movement::Extend;
let text = doc.text();
let text_slice = text.slice(..);

Expand All @@ -5613,7 +5614,13 @@ fn match_brackets(cx: &mut Context) {
doc.set_selection(view.id, selection);
}

//
fn match_brackets(cx: &mut Context) {
match_brackets_impl(cx, Movement::Move);
}

fn extend_brackets(cx: &mut Context) {
match_brackets_impl(cx, Movement::Extend);
}

fn jump_forward(cx: &mut Context) {
let count = cx.count();
Expand Down