From ebc14d9d206a0960a97fd706bd8fbfbedf2fb203 Mon Sep 17 00:00:00 2001 From: Omnikar Date: Wed, 10 Nov 2021 21:33:31 -0500 Subject: Add `m` textobject for pair under cursor (#961) --- helix-term/src/commands.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'helix-term') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 089f92f1..24c38dd5 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4819,6 +4819,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) -- cgit v1.2.3-70-g09d2