Replies: 1 comment
-
Lua does not have regular expressions, it's as simple as that. Vim does, but crossing the Lua--Vim bridge incurs some overhead -- but not enough to warrant adding yet another regular expression engine (or conversion). Nobody has yet provided a compelling use case why the current two alternatives are not enough. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve been diving into Neovim lately after noticing its scripts trending on GitHub. While I’m not a Neovim user myself and don’t have much experience with it, as a Lua enthusiast, I was excited to learn that Neovim bundles LPeg. This led me to explore some interesting possibilities.
While digging into the code, I noticed that Neovim uses LPeg for glob patterns. This struck me as a bit unusual since glob patterns are typically more straightforwardly converted to regex. It made me wonder about the decision-making process behind this choice.
Additionally, I’ve seen that Neovim tends to favor Vim regex over PCRE, which got me thinking about the reasons for this preference. I came across some discussions hinting at the possibility of creating a converter between the two syntaxes. With this in mind, I decided to experiment with a simple converter from PCRE to Vim regex using LPeg. Here’s the toy converter I came up with:
It’s a toy converter, and I’m sure it’s not perfect. But it got me thinking about the potential for a more comprehensive tool. I wonder if anyone else has tackled similar projects or has insights into the broader context of regex usage within Neovim.
Beta Was this translation helpful? Give feedback.
All reactions