Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right ".clang-format" location?

I cannot understand the following text from the clang-format manual:

.clang-format file located in one of the parent
directories of the source file (or current
directory for stdin).

What does "current directory for stdin" mean? Is it the current directory or the stdin?

Is it possible to specify the .clang-format location by a full path?

like image 661
Endre Avatar asked Apr 18 '17 16:04

Endre


People also ask

How do you customize your clang-format?

clang-format supports two ways to provide custom style options: directly specify style configuration in the -style= command line option or use -style=file and put style configuration in the . clang-format or _clang-format file in the project directory.

How do I use clang-format in Windows?

Getting Started with Clang-Format The shortcut Ctrl+Shift+I is for Linux. If you want to use it on Windows, you need to use Alter+Shift+F. If you do not have Clang-Format installed on your system, you will see the prompt: The 'clang-format' command is not available.

How do I turn off clang-format?

Disabling Formatting on a Piece of Code The code between a comment // clang-format off or /* clang-format off */ up to a comment // clang-format on or /* clang-format on */ will not be formatted. The comments themselves will be formatted (aligned) normally.


1 Answers

It is the current directory. And there is no way to set .clang-format path. clang-format only scans from the directories and up until it encounters the file.

like image 111
Yoonian Avatar answered Sep 30 '22 15:09

Yoonian