Home | History | Annotate | Line # | Download | only in misc
      1 # $NetBSD: dot.clang-format,v 1.1 2024/08/23 09:06:37 wiz Exp $
      2 #
      3 # This is a base for using clang-format with NetBSD sources.
      4 #
      5 # /usr/share/misc/style has more details, some of which cannot be
      6 # captured here.
      7 #
      8 # To use it, rename it to .clang-format and put it in the directory
      9 # you're editing, or call clang-format with the --style argument:
     10 #
     11 #	clang-format --style=file:/usr/share/misc/dot.clang-format [...] file.c
     12 #
     13 # 80 characters line length
     14 ColumnLimit: 80
     15 # if comments get too long, fmt them.
     16 ReflowComments: true
     17 # default indentation level
     18 IndentWidth: 8
     19 # also for struct initializers
     20 BracedInitializerIndentWidth: 8
     21 # prefer using tabs to spaces when indenting
     22 UseTab: ForContinuationAndIndentation
     23 # indent 1 space more per #if-level
     24 PPIndentWidth: 1
     25 # and put the space after the hash but before the keyword (i.e., "# if")
     26 IndentPPDirectives: AfterHash
     27 # backslashes at end-of-line are aligned, but as far left as possible
     28 AlignEscapedNewlines: Left
     29 # not supported in clang-format 18, would include the last line (without backslash) in the offset consideration
     30 #AlignEscapedNewlines: LeftWithLastLine
     31 #
     32 # if function arguments get too long, start new line indented by 4
     33 AlignAfterOpenBracket: DontAlign
     34 ContinuationIndentWidth: 4
     35 # but keep first parameters on the first line
     36 AllowAllParametersOfDeclarationOnNextLine: False
     37 AllowAllArgumentsOnNextLine: false
     38 # for struct's etc. use 8 characters indent as well
     39 ConstructorInitializerIndentWidth: 8
     40 # attach "{", except for functions
     41 BreakBeforeBraces: WebKit
     42 # for functions, add newline after return type
     43 AlwaysBreakAfterReturnType: TopLevelDefinitions
     44 # align structure elements to the right
     45 AlignArrayOfStructures: Right
     46