Home

A simple .clang-format

Written on 2025-01-18

This is just my current .clang-format. It's close enough to my preference given the time/effort that I put in it.

I'm posting it so that I can access it in a pinch, and share it with people who ask me for a starting point.

# This is just the default style that is closest to my preference.
BasedOnStyle: Chromium
# 2 spaces is too hard on my eyes.
IndentWidth: 4
# 80 columns can be a little narrow at times. 100 is enough for personal projects, where I keep names short.
ColumnLimit: 100
# Just putting those `&` and `*` on the right side. I care about readability, not language legalese.
DerivePointerAlignment: false
PointerAlignment: Left
# When wrapping function arguments, give them each a line.
BinPackArguments: false
# I don't want half indents for access modifiers.
IndentAccessModifiers: false
AccessModifierOffset: -4