Add `m` textobject for pair under cursor (#961)

pull/1076/head
Omnikar 3 years ago committed by GitHub
parent 4d22454386
commit ebc14d9d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4819,6 +4819,14 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) {
'c' => textobject_treesitter("class", range), 'c' => textobject_treesitter("class", range),
'f' => textobject_treesitter("function", range), 'f' => textobject_treesitter("function", range),
'p' => textobject_treesitter("parameter", 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 // TODO: cancel new ranges if inconsistent surround matches across lines
ch if !ch.is_ascii_alphanumeric() => { ch if !ch.is_ascii_alphanumeric() => {
textobject::textobject_surround(text, range, objtype, ch, count) textobject::textobject_surround(text, range, objtype, ch, count)

Loading…
Cancel
Save