aperezdc / vim-template

Simple templates plugin for Vim
371 stars 154 forks source link

More control over global template file name prefixes #106

Open benlindsay opened 8 years ago

benlindsay commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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:

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 commented 8 years ago

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.