# Google C/C++ Code Style settings # https://clang.llvm.org/docs/ClangFormatStyleOptions.html # Author: Kehan Xue, kehan.xue (at) gmail.com --- --- Language: Cpp BasedOnStyle: Google AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: None AlignOperands: Align AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding AllowShortLambdasOnASingleLine: Inline AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakTemplateDeclarations: Yes BinPackArguments: true BreakBeforeBraces: Custom BraceWrapping: AfterCaseLabel: false AfterClass: false AfterStruct: false AfterControlStatement: Never AfterEnum: false AfterFunction: false AfterNamespace: false AfterUnion: false AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false BreakBeforeBinaryOperators: None BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeColon BreakInheritanceList: BeforeColon ColumnLimit: 150 CompactNamespaces: false ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false # Make sure the * or & align on the left EmptyLineBeforeAccessModifier: LogicalBlock FixNamespaceComments: true IncludeBlocks: Regroup IndentCaseLabels: true IndentPPDirectives: None IndentWidth: 4 KeepEmptyLinesAtTheStartOfBlocks: true MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true PointerAlignment: Left ReflowComments: true # SeparateDefinitionBlocks: Always # Only support since clang-format 14 SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: c++17 TabWidth: 4 UseTab: Never IncludeCategories: # Non .h / .hpp package headers - Regex: '<[^.]*>' Priority: 1 CaseSensitive: false # C system headers - Regex: '<.*\.h>' Priority: 2 CaseSensitive: false # C++ system headers - Regex: '<.*.hpp>' Priority: 3 CaseSensitive: false # Cuda headers - Regex: '<.*\.cuh>' Priority: 4 CaseSensitive: false # Cuda C - Regex: '<.*\.cu>' Priority: 5 CaseSensitive: false # Cuda C++ - Regex: '<.*\.cuhpp>' Priority: 6 CaseSensitive: false # Local package headers - Regex: '".*"' Priority: 7 CaseSensitive: false # Adds all of the languages so `git clang-format` works on all of them # https://clang.llvm.org/docs/ClangFormatStyleOptions.html#languages/ # # You could also have everyone run `git config --global clangformat.extensions hpp,cpp,cxx,c++,c,h,h++` to achieve the same effect, but this is easier to maintain # and works for all users. --- Language: JavaScript IndentWidth: 2 ColumnLimit: 100 --- Language: Java IndentWidth: 2 --- Language: Json IndentWidth: 2 --- Language: Proto IndentWidth: 2 --- Language: CSharp IndentWidth: 2 ---