aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorOmnikar2021-11-11 02:33:31 +0000
committerGitHub2021-11-11 02:33:31 +0000
commitebc14d9d206a0960a97fd706bd8fbfbedf2fb203 (patch)
treebf43f4167aed459b03a893db949fb72b879d340a /helix-term
parent4d22454386d52d14f626b209016a71f119cc1cbf (diff)
Add `m` textobject for pair under cursor (#961)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 8 insertions, 0 deletions
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)