Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning off "created by" header when generating files in CLion

Tags:

clion

When you create file in CLion, the following header is placed in the top of file:

//
// Created by <username> on 14.01.18.
//

Someone can remove this header by go to SettingsEditorFile and Code TemplatesIncludesC File Header. There will be text:

#if ($HEADER_COMMENTS)
//
// Created by $USER_NAME on ${DATE}.
#if ($ORGANIZATION_NAME && $ORGANIZATION_NAME != "")
// Copyright (c) $YEAR ${ORGANIZATION_NAME}#if (!$ORGANIZATION_NAME.endsWith(".")).#end All rights reserved.
#end
//
#end

I can delete this text and header will be removed. But looks like if I set $HEADER_COMMENTS variable to false then header will be removed too. So my question is:

What is $HEADER_COMMENTS variable and how can I change it?

like image 439
diralik Avatar asked Jan 13 '18 21:01

diralik


People also ask

How do I switch between files in clion?

If header and implementation files are already open you can switch between windows with double-shift and enter keys.

How do I open a header file in clion?

Go to Header/Source To invoke Go to Header/Source, press F10 or call Navigate | Header/Source from the main menu.

How do I save a template in clion?

Save a file as a template Open a file in the editor. From the main menu, select File | Save File as Template. In the Save File as Template dialog, specify the new template name and edit the body, if necessary. Apply the changes and close the dialog.


2 Answers

I found this post at when searching to do the same thing. I didn't want to delete the whole thing as I'm using CLion for college and I might have a use for a template but I don't like the current one. I "fixed" it by making the test a not if for now. I said I'd put it here in case anyone else came searching for the same idea.

#if (!$HEADER_COMMENTS)
//
// Created by $USER_NAME on ${DATE}.
#if ($ORGANIZATION_NAME && $ORGANIZATION_NAME != "")
// Copyright (c) $YEAR ${ORGANIZATION_NAME}#if (!$ORGANIZATION_NAME.endsWith(".")).#end All rights reserved.
#end
//
#end
like image 103
Simon Farrelly Avatar answered Oct 08 '22 07:10

Simon Farrelly


See https://www.jetbrains.com/help/clion/creating-and-editing-file-templates.html

Apparently the variable ${HEADER_COMMENTS} is always true and used for testing purposes, so you can't influence it.

like image 23
arved Avatar answered Oct 08 '22 05:10

arved