Default comment in all new source files.
Hi,
Is it possible to add a "custom" comment which will be automatically added to all newly created files ?
Something like a signature in an email client, but then add the comment at the top, not the bottom.
The comment would look like this :
/****************************************************************************************
* Exercise : ** Chapter : ** Name-Of-Book *
* *
* Short discription of the exercise *
* *
****************************************************************************************/
and then the #include statement.
I asked about something similar when CLion was still in E.A.P. (having a custom template and not the "Hello World" one that is used for every new project.
So I don't know if this fits in that category or not, and if there is an ITA when such feature would be added.
Patrick
请先登录再写评论。
I'm not sure I fully understand what you're looking for, but there are File and Code Templates under Preferences -> Editor. It controls things like how default include guards are added to .h files. You may be able to use that to make a template like the one you described.
Matthew,
Thanks for your reply.
You method works but it doesn't use this templace for the first (main.cpp) file when you start a new project.
New C source files added afterwards do work.
So I guess it partially works.
Do you also know if it's possible (and how) to add code that will automatically insert certain data ?
for example when the new file is created on April 30th that date is automatically inserted into the source file.
I think I once saw a tutorial that mentioned this, but it was for Eclipse.
When you open Live Template configuration there is a link to http://velocity.apache.org/engine/devel/user-guide.html#Velocity_Template_Language_VTL:_An_Introduction
As for predefined macros, here is Help from IDEA.
Perhaps it also works for CLion.
It is also possible to specify an arbitrary number of custom variables in the format ${<VARIABLE_NAME>}. In this case, before the new file is created, you will be prompted with a dialog where you can define particular values for all custom variables.
Using the #parse directive, you can include templates from the Includes tab, by specifying the full name of the desired template as a parameter in quotation marks. For example:
#parse("File Header.java")
Thank,
I completely looked over that link.