nvim-snippy
nvim-snippy copied to clipboard
Support choices mixed with vim functions
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|}
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.
I think eval elements should be parsed separately and replaced with the evaluated strings/lines, then the parser would parse the rest.
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()`|}