... | ... | @@ -12,4 +12,8 @@ In order to reformat a file `file_to_format.hh` in-place, you can call |
|
|
```bash
|
|
|
clang-format -style=file -i file_to_format.hh
|
|
|
```
|
|
|
Note that if your opened the file in an editor, you have to save your changes and make sure to reload the file after reformatting. The option `-style=file` will load the style parameters from a .clang-format file in one of the parent directories of the source file. The option `-i` will perform the reformatting in-place. If you just want to look at the reformatted file without applying any changes or store the output into a different file, you can ommit the `-i`. |
|
|
\ No newline at end of file |
|
|
Note that if your opened the file in an editor, you have to save your changes and make sure to reload the file after reformatting. The option `-style=file` will load the style parameters from a .clang-format file in one of the parent directories of the source file. The option `-i` will perform the reformatting in-place. If you just want to look at the reformatted file without applying any changes or store the output into a different file, you can ommit the `-i`.
|
|
|
#### Tools
|
|
|
For several IDEs and editors there are plugins to use clang-format directly, without the need for calling it on the command-line.
|
|
|
- Qt-Creator: http://doc.qt.io/qtcreator/creator-beautifier.html
|
|
|
- Vim: https://github.com/rhysd/vim-clang-format |
|
|
\ No newline at end of file |