diff options
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands.rs | 12 | ||||
-rw-r--r-- | helix-term/src/keymap.rs | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 8ee05ece..2a8f462d 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -401,6 +401,8 @@ impl MappableCommand { goto_prev_class, "Goto previous class", goto_next_parameter, "Goto next parameter", goto_prev_parameter, "Goto previous parameter", + goto_next_comment, "Goto next comment", + goto_prev_comment, "Goto previous comment", dap_launch, "Launch debug target", dap_toggle_breakpoint, "Toggle breakpoint", dap_continue, "Continue program execution", @@ -5381,6 +5383,14 @@ fn goto_prev_parameter(cx: &mut Context) { goto_ts_object_impl(cx, "parameter", Direction::Backward) } +fn goto_next_comment(cx: &mut Context) { + goto_ts_object_impl(cx, "comment", Direction::Forward) +} + +fn goto_prev_comment(cx: &mut Context) { + goto_ts_object_impl(cx, "comment", Direction::Backward) +} + fn select_textobject_around(cx: &mut Context) { select_textobject(cx, textobject::TextObject::Around); } @@ -5423,6 +5433,7 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { 'c' => textobject_treesitter("class", range), 'f' => textobject_treesitter("function", range), 'p' => textobject_treesitter("parameter", range), + 'o' => textobject_treesitter("comment", range), 'm' => { let ch = text.char(range.cursor(text)); if !ch.is_ascii_alphanumeric() { @@ -5456,6 +5467,7 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { ("c", "Class (tree-sitter)"), ("f", "Function (tree-sitter)"), ("p", "Parameter (tree-sitter)"), + ("o", "Comment (tree-sitter)"), ("m", "Matching delimiter under cursor"), (" ", "... or any character acting as a pair"), ]; diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 0147f58e..a5a615f3 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -608,6 +608,7 @@ impl Default for Keymaps { "f" => goto_prev_function, "c" => goto_prev_class, "p" => goto_prev_parameter, + "o" => goto_prev_comment, "space" => add_newline_above, }, "]" => { "Right bracket" @@ -616,6 +617,7 @@ impl Default for Keymaps { "f" => goto_next_function, "c" => goto_next_class, "p" => goto_next_parameter, + "o" => goto_next_comment, "space" => add_newline_below, }, |