-
Notifications
You must be signed in to change notification settings - Fork 34
Code style guidelines
- prefer 4 space indentation
- prefer
snake_case
- use standard header for new files, see below
If you are a happy user of CLion you can just open the existing project cloned from this repo. Settings must be applied automatically. To double check this go to Settings (File->Settings OR ctrl+alt+s
) and navigate to Editor/Code Style:
and make sure that highlighted values are correct i.e. Scheme = Project and Line separator = Unix
Next navigate to Editor/File and code templates:
and make sure its similar to what you see on the picture above.
To contribute a code style just change these settings and make a Pull Request. Here is a reference on how to use templates in CLion products: configuring code style
One can define live templates to speed up coding in CLion (as well as any IntelliJ based product). Here is a small guide on how to add Copyright live template:
Bring up Settings dialog (ctrl+alt+s
) and navigate to Editor/Live templates:
In the right panel do the following:
- Expand C/C++ and a new template (
alt+insert
) - Define Abbreviation and Description, in our example above it is copy and copyright
- Define desired template following this guide
- Define variables' values, existing variables are described in this guide
- Define scope (in our case any place in C/C++)
Now open any C++ header/source file type copy and press Tab
, copy will be substituted with the template:
CLion will ask to redefine variables' values if default are good just proceed pressing Enter
.