From 1f456d101188888847d7dc7151fa3199d31d9377 Mon Sep 17 00:00:00 2001 From: Omnikar Date: Tue, 2 Nov 2021 16:23:53 -0400 Subject: [PATCH] Add `m` textobject for pair under cursor --- helix-term/src/commands.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index cc9106eb734c..13ccb2740dfb 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4570,6 +4570,14 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { 'c' => textobject_treesitter("class", range), 'f' => textobject_treesitter("function", range), 'p' => textobject_treesitter("parameter", range), + 'm' => { + let ch = text.char(range.cursor(text)); + if !ch.is_ascii_alphanumeric() { + textobject::textobject_surround(text, range, objtype, ch, count) + } else { + range + } + } // TODO: cancel new ranges if inconsistent surround matches across lines ch if !ch.is_ascii_alphanumeric() => { textobject::textobject_surround(text, range, objtype, ch, count)