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

Option to ask for user input for undefined variables? #136

Open
jasonboukheir opened this issue Jun 26, 2019 · 2 comments
Open

Option to ask for user input for undefined variables? #136

jasonboukheir opened this issue Jun 26, 2019 · 2 comments

Comments

@jasonboukheir
Copy link

jasonboukheir commented Jun 26, 2019

Hi there! Thanks for the plugin!

There's a vscode plugin I use frequently called "File Templates", and it has a feature where you can provide the arguments for undefined template variables when creating a file. This is useful for me, because at work we have a header where we have to define the product/module the script belongs to, which isn't easily available through env vars or the filepath.

I'm thinking it might be easy enough to supply the vars as optional parameters to the :Template function. Sort of like:
:Template <pattern> <undefined_var_1=value> <undefined_var_2=value>

Perhaps the behavior is that if the variable is defined, these values will override the defaults there?

At the moment, I keep the variables un-expanded, and substitute them when I create the file.

@jasonboukheir
Copy link
Author

I'm not so familiar with vimscript, so if there's an easy way for me to workaround this, I'm all ears 😄

@SirWrexes
Copy link

I came here for the exact same reason. It would be nice to have something like a %USERINPUT% variable that prompts for filling on template insertion.
I haven't looked into it -- don't have time to yet -- but I'll probably try scripting it with the template_user_variables command later.

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

No branches or pull requests

2 participants