on master help sign in
Add `m` textobject for pair under cursor (#961)
ebc14d9Omnikar
helix-term/src/commands.rs+8
@@ -4819,6 +4819,14 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) {
4819 'c' => textobject_treesitter("class", range),
4819 'c' => textobject_treesitter("class", range),
4820 'f' => textobject_treesitter("function", range),
4820 'f' => textobject_treesitter("function", range),
4821 'p' => textobject_treesitter("parameter", range),
4821 'p' => textobject_treesitter("parameter", range),
4822+ 'm' => {
4823+ let ch = text.char(range.cursor(text));
4824+ if !ch.is_ascii_alphanumeric() {
4825+ textobject::textobject_surround(text, range, objtype, ch, count)
4826+ } else {
4827+ range
4828+ }
4829+ }
4822 // TODO: cancel new ranges if inconsistent surround matches across lines
4830 // TODO: cancel new ranges if inconsistent surround matches across lines
4823 ch if !ch.is_ascii_alphanumeric() => {
4831 ch if !ch.is_ascii_alphanumeric() => {
4824 textobject::textobject_surround(text, range, objtype, ch, count)
4832 textobject::textobject_surround(text, range, objtype, ch, count)