Skip to content

Instantly share code, notes, and snippets.

@hydrz
Last active October 23, 2020 20:46
Show Gist options
  • Save hydrz/0007ca7b861299bf28318e0213b49083 to your computer and use it in GitHub Desktop.
Save hydrz/0007ca7b861299bf28318e0213b49083 to your computer and use it in GitHub Desktop.
Personal style for clang automatic reformatting.
# Personal style for automatic reformatting.
# https://google.github.io/styleguide/cppguide.html
# See Clang docs: http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Google
# Allow double brackets such as std::vector<std::vector<int>>.
Standard: Cpp11
# Indent 4 spaces at a time.
IndentWidth: 4
# Use 2 space negative offset for access modifiers
AccessModifierOffset: -2
# Keep lines under 180 columns long.
ColumnLimit: 180
# Always break before braces
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterStruct: false
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# Keeps extern "C" blocks unindented.
AfterExternBlock: false
# Indent
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IncludeBlocks: Preserve
# Align
AlignOperands: true
AlignConsecutiveAssignments: true
AlignTrailingComments: true
AlignConsecutiveMacros: true
# Right-align pointers and references
PointerAlignment: Right
# AllowShort
AllowShortCaseLabelsOnASingleLine: false
# KeepEmptyLines
KeepEmptyLinesAtTheStartOfBlocks: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment