Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More trigger-types #547

Closed
L3MON4D3 opened this issue Aug 21, 2022 · 18 comments · Fixed by #923
Closed

More trigger-types #547

L3MON4D3 opened this issue Aug 21, 2022 · 18 comments · Fixed by #923

Comments

@L3MON4D3
Copy link
Owner

Currently we have regTrig and not regTrig (eg. a plain string), but since lua-patterns are quite limited it would be nice to support full regex via either the soon-to-be included jsregexp or just vims builtin regexes (or just both).
One nice interface for this include retiring regTrig (backwards compatibly) and instead introducing an arg triggerType, which can be

  • "plain" for just text
  • "lua" for a lua-pattern
  • "ecma" for ecmascript-regex if jsregexp is available
  • "vim" for vim-regex
@leiserfg
Copy link
Contributor

Currently regex:match_str({str} returns a tuple with the position of the full match, and that does not allow passing the matched groups. Adding that API to nvim should be an easy task, because match_str is just wrapping an internal function that returns an object that contains such groups. I was thinking to make the PR myself (I'm a bit scared after around 6 years without touching C/C++), but I'm ok if someone else takes over it. In any case, it's a blocker, at least if we wanna keep the same API for all the triggers.

@L3MON4D3
Copy link
Owner Author

Sadly nvim does not expose a way to get the matches of the regex, only the full match. So if we wanna make it, a PR to nvim will be required. I assume if someone wants complex regexes, probably (s)he will want to manipulate the string as well.

@leiserfg couldn't we use matchlist() in this case?

@L3MON4D3
Copy link
Owner Author

Currently regex:match_str({str} returns a tuple with the position of the full match, and that does not allow passing the matched groups. Adding that API to nvim should be an easy task, because match_str is just wrapping an internal function that returns an object that contains such groups. I was thinking to make the PR myself (I'm a bit scared after around 6 years without touching C/C++), but I'm ok if someone else takes over it. In any case, it's a blocker, at least if we wanna keep the same API for all the triggers.

Riiight, theres a lua-api to vim-regexes... Yeah it's tempting to use that, true. I'll take a closer look tomorrow, then I'll understand what you are talking about😅

@leiserfg
Copy link
Contributor

We could start with matchlist and then move to a proper lua API once it's in place, with the only inconvenience of being unable to store the compiled regex.

@hiberabyss

This comment was marked as off-topic.

@leiserfg

This comment was marked as off-topic.

@hiberabyss

This comment was marked as off-topic.

@leiserfg

This comment was marked as off-topic.

@hiberabyss

This comment was marked as off-topic.

@L3MON4D3

This comment was marked as off-topic.

@L3MON4D3

This comment was marked as off-topic.

@hiberabyss

This comment was marked as off-topic.

@hiberabyss

This comment was marked as off-topic.

@leiserfg

This comment was marked as off-topic.

@leiserfg

This comment was marked as off-topic.

@L3MON4D3

This comment was marked as off-topic.

@medwatt
Copy link

medwatt commented Jan 20, 2023

Sorry for commenting on an old issue, but is there any update on having proper regex support?

@L3MON4D3
Copy link
Owner Author

Finally got to this, follow #923 :D

@L3MON4D3 L3MON4D3 linked a pull request Jun 14, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants