-
Notifications
You must be signed in to change notification settings - Fork 69
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
User function w/o argument in templates #181
Comments
Thanks for the good description. I've updated this template function feature now to match closely to what you want. Except one thing: the template function must take the I believe the updated documentation should be correct according to the updated feature now.
Could you elaborate on this idea some more?
Please check the update docs; do you find it to be aligned with how you expect it to work now?
Thanks for the kind words! :) |
Nice. So if I understand your changes correctly, the function takes the context argument as the first argument instead of taking it as the second argument. Thereby the context argument is given correctly, even if there is no string as the second argument. Is that correct? It is merely my lack of understanding, that caused med to think I could define a function that didn't accept arguments. Looking back, I think it was sufficiently described. But I also think your changes, accepting
Yes. My idea was to make it possible to add your own entries to the context dictionary. So in code it would look something like this:
Allowing me to use
These could easily be created as user defined substitution-functions, but I think it would be nice to gather these 'non-argument' variables in the context dictionary.
Yes, it looks good. At least I think I understand it know ;) However, I expanded a little on the substitution function, by providing the predefined function as an example. Please see pull request #182. |
Yes, exactly. It makes more sense this way, and it makes it easy to allow the second argument to be optional.
Ah, I see. Would you mind opening a new issue for this? That would make it easier for me to quickly get up to context when I have time to fully consider it.
Great, thanks! |
Nice! I've finally opened a new issue describing the functionality requested. See #184. Thanks again. |
Description
I have a template with the following line:
In my
init.vim
I have:This, however, just result in
{{GetDay}}
in the new file when using the template.Workaround
A solution I've found, is to have
GetDay
take an argument and just give a 'dummy' argument in the template. Like this:Template file:
init.vim function:
This makes the template behave as intended.
Proposed solution
Am I going about it wrong? Otherwise, I'd suggest one of the following:
My vimscript capabilities are, unfortunately, non-existing. But I'll be happy to take care of option 3 if that's the chosen route.
And again, Karl, I cannot thank you enough for your vim plugins and your continual, non-stop work on them!
The text was updated successfully, but these errors were encountered: