WolfgangMehner/vim-plugins

The idiomatic way to add more templates to new file

Closed this issue · 5 comments

It's more a question, not an issue.
Let's say i want add header quards autmoatically to every new .h file. I added new template to c.preprocessor.template, but i failed to figure out how to make it add to every new file, like it does with comment.file-description-header from c.comments.template.

Of coures I can just add it to file-description-header template, but it just looks wrong. What is the right way? Or point me to the documentation describing this case. Thanks.

The insertion of "Comment.file-description-header" is hardwired until now. I can see how this is problematic. Let me come back to this later today or this week.

As a quick fix, you could add this to your .vimrc:

  g:C_InsertFileHeader = 'no'

Now no file headers will be inserted automatically. So you can always choose the right one from the template library.

I will address the more general issue later.

Thanks, that's good, but it's more likely opposit what i asked, i asked a way to specify which templates will be included automatically, to add one after comment header. But i hope you will address it later, like more general issue.

This has been addressed (for C-Support) by 3c9d87b .

For the documentation, see here:

5.4 FILE SKELETONS *csupport-file-skeleton*

This functionality will be added to the other plug-ins as well, stay tuned ...

I've added this to a couple of other plug-ins:
News - Customizable File Skeletons

And also to Latex-Support:
97a3a9f