-
Notifications
You must be signed in to change notification settings - Fork 66
User function w/o argument in templates #181
Copy link
Copy link
Closed
Description
Description
I have a template with the following line:
Day: {{GetDay}}In my init.vim I have:
function! GetDay() abort
let l:day_name = strftime("%A")
return day_name
endfunctionThis, 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:
Day: {{GetDay dummyarg}}init.vim function:
function! GetDay(...) abort
let l:day_name = strftime("%A")
return day_name
endfunctionThis makes the template behave as intended.
Proposed solution
Am I going about it wrong? Otherwise, I'd suggest one of the following:
- Accept function substitutions without arguments.
- Allow for adding entries to the context-dictionary (is this already possible?). This could then be used for these small functions without arguments. This might be a good idea regardless.
- Describe that an argument is required in the documentation.
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!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels