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

More control over global template file name prefixes #106

Open
benlindsay opened this issue Jun 29, 2016 · 4 comments
Open

More control over global template file name prefixes #106

benlindsay opened this issue Jun 29, 2016 · 4 comments

Comments

@benlindsay
Copy link

I want to be able to have access to the shipped templates in your plugin, but I'd also like to have my own global templates that look like ~/.vim/templates/ of the form template.ext instead of =template=.ext. I just changed. For me it works fine to just change g:templates_global_name_prefix to g:templates_name_prefix on line 516 and just change g:templates_name_prefix in my .vimrc, but it might be better to just prevent g:templates_global_name_prefix from setting the expected prefix for the shipped templates since we don't need to change file names of your shipped templates.

@muff1nman
Copy link
Collaborator

Hm, yes I think this makes sense. Perhaps it can be done in such a way that it doesn't break everyone's configs.

@benlindsay
Copy link
Author

I think that if the expected prefix for the shipped templates is just hard-coded as =template= and prevented from being changed by the user, no one's configs would break. I doubt anyone changes the names of the shipped templates inside the repo.

@muff1nman
Copy link
Collaborator

Agreed. That would be a safe bet, but actually looking over the current setup, this might be a good opportunity to cleanup the variable names to make them more clear.

What about the following:

  • g:templates_name_prefix -> g:templates_pwd_prefix
    • Same behavior of controlling prefix of templates within pwd and parents
  • g:templates_global_name_prefix -> g:templates_global_prefix
    • Would only control user defined template prefixes from g:templates_directory
  • g:templates_builtin_prefix
    • New variable to define builtin prefix. Doesn't necessarily need to be exposed, but I don't see it hurting anything to allow it to be controlled

And then to make it not break configs, we would still look for the two old variables and set the new ones automatically.

Thoughts?

@benlindsay
Copy link
Author

I personally don't think the new names proposed for the first two increase clarity enough to be worth breaking people's configs. I would just recommend adding the g:templates_builtin_prefix variable with =template= as the default value. To be honest though, I already switched to vim-skeleton because, even though it doesn't have the nice builtin templates like vim-template, I found it easier to customize for my purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants