Closed prescientmoon closed 4 months ago
Thanks for the issue!
Matching in 'mini.ai' is done with Lua patterns. The %b
special pattern item does not seem to work with multibyte characters. You can check it by executing :=string.find('⟨abc⟩', "%b⟨⟩")
, which will print nil
indicating that no match is found. In turn, plain <>
works: =string.find('<abc>', "%b<>")
gives 1, 5
.
Closing as not not supported by Lua patterns.
Thanks for the issue!
Matching in 'mini.ai' is done with Lua patterns. The
%b
special pattern item does not seem to work with multibyte characters. You can check it by executing:=string.find('⟨abc⟩', "%b⟨⟩")
, which will printnil
indicating that no match is found. In turn, plain<>
works:=string.find('<abc>', "%b<>")
gives1, 5
.Closing as not not supported by Lua patterns.
Bonus question: any idea why using ⟨.-⟩
for the unbalanced version always removes the brackets, even when using div
? Could it be that the "inside" still deletes all but one byte of the bracket or something similar? Would I have to use something different for the second argument (other than ^.().*().$
)
Bonus question: any idea why using
⟨.-⟩
for the unbalanced version always removes the brackets, even when usingdiv
? Could it be that the "inside" still deletes all but one byte of the bracket or something similar? Would I have to use something different for the second argument (other than^.().*().$
)
I would need more information with actual examples of textobject spec, text before, taken steps, and text after.
I would need more information with actual examples of textobject spec, text before, taken steps, and text after.
For the textobject v = { "⟨.-⟩", "^.().*().$" }
and the text ⟨abc⟩
, positioning the cursor on the b
and pressing div
will delete the entire string.
For the textobject
v = { "⟨.-⟩", "^.().*().$" }
and the text⟨abc⟩
, positioning the cursor on theb
and pressingdiv
will delete the entire string.
This is because both "⟨" and "⟩" are multibyte characters, while "." in Lua pattern matches a single byte character. Using { '⟨.-⟩', '^⟨().*()⟩$' }
as specification should solve this.
Contributing guidelines
Module(s)
mini.ai
Description
I tried passing
v = { "%b⟨⟩", "^.().*().$" }
tocustom_textobjects
, butdiv
(and other similar commands) always fail to find anything to match.Neovim version
0.9.5
Steps to reproduce
Load the following config
For convenience, here's a string of text you can check the keybind on
⟨abc⟩
Expected behavior
No response
Actual behavior