Skip to content

Instantly share code, notes, and snippets.

@larshei
Created May 13, 2020 07:26
Show Gist options
  • Select an option

  • Save larshei/138918717cc0ddcb6a884f3c3e21e160 to your computer and use it in GitHub Desktop.

Select an option

Save larshei/138918717cc0ddcb6a884f3c3e21e160 to your computer and use it in GitHub Desktop.
My default config for .clang-format. Place this in e,g, the root folder of your project. May be used by e.g. Visual Code to autoformat code sections or whole files.
# =========== C / Cpp ==============
Language: Cpp
TabWidth: 4
IndentWidth: 4
UseTab: Never
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
# AlignConsecutiveMacros: true # not working 'unknown key' error
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
PointerAlignment: Left
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
# =================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment