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

Support choices mixed with vim functions #49

Open
kassio opened this issue Jan 26, 2022 · 3 comments
Open

Support choices mixed with vim functions #49

kassio opened this issue Jan 26, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@kassio
Copy link

kassio commented Jan 26, 2022

First of all, thanks! Great plugin!

Would it be possible to enable the plugin to support mixed vim functions and static texts in the placeholder choices? Something like:

snippet today
  ${1|`strftime('%c')`,today|}
@dcampos dcampos added the enhancement New feature or request label Feb 2, 2022
@dcampos
Copy link
Owner

dcampos commented Feb 2, 2022

First of all, thanks! Great plugin!

Thanks!

Would it be possible to enable the plugin to support mixed vim functions and static texts in the placeholder choices?

I think it would be possible, but I don't know how easily it could be added without increasing the complexity of the parser. If someone comes up with a simple solution, I'd happily review/accept a pull request.

On the plus side, I think it would be a feature unique to Snippy, which might make it worth adding.

@mg979
Copy link
Contributor

mg979 commented Feb 2, 2022

I think eval elements should be parsed separately and replaced with the evaluated strings/lines, then the parser would parse the rest.

@kassio
Copy link
Author

kassio commented Aug 9, 2023

Another idea, that I'm not sure if better or worse, but lua supports functions with multiple returns, so maybe we could do something like:

function foo()
  return 1, 2, 3
end
snippet today
  ${1|`foo()`|}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants