11.1Swiz# $NetBSD: dot.clang-format,v 1.1 2024/08/23 09:06:37 wiz Exp $
21.1Swiz#
31.1Swiz# This is a base for using clang-format with NetBSD sources.
41.1Swiz#
51.1Swiz# /usr/share/misc/style has more details, some of which cannot be
61.1Swiz# captured here.
71.1Swiz#
81.1Swiz# To use it, rename it to .clang-format and put it in the directory
91.1Swiz# you're editing, or call clang-format with the --style argument:
101.1Swiz#
111.1Swiz#	clang-format --style=file:/usr/share/misc/dot.clang-format [...] file.c
121.1Swiz#
131.1Swiz# 80 characters line length
141.1SwizColumnLimit: 80
151.1Swiz# if comments get too long, fmt them.
161.1SwizReflowComments: true
171.1Swiz# default indentation level
181.1SwizIndentWidth: 8
191.1Swiz# also for struct initializers
201.1SwizBracedInitializerIndentWidth: 8
211.1Swiz# prefer using tabs to spaces when indenting
221.1SwizUseTab: ForContinuationAndIndentation
231.1Swiz# indent 1 space more per #if-level
241.1SwizPPIndentWidth: 1
251.1Swiz# and put the space after the hash but before the keyword (i.e., "# if")
261.1SwizIndentPPDirectives: AfterHash
271.1Swiz# backslashes at end-of-line are aligned, but as far left as possible
281.1SwizAlignEscapedNewlines: Left
291.1Swiz# not supported in clang-format 18, would include the last line (without backslash) in the offset consideration
301.1Swiz#AlignEscapedNewlines: LeftWithLastLine
311.1Swiz#
321.1Swiz# if function arguments get too long, start new line indented by 4
331.1SwizAlignAfterOpenBracket: DontAlign
341.1SwizContinuationIndentWidth: 4
351.1Swiz# but keep first parameters on the first line
361.1SwizAllowAllParametersOfDeclarationOnNextLine: False
371.1SwizAllowAllArgumentsOnNextLine: false
381.1Swiz# for struct's etc. use 8 characters indent as well
391.1SwizConstructorInitializerIndentWidth: 8
401.1Swiz# attach "{", except for functions
411.1SwizBreakBeforeBraces: WebKit
421.1Swiz# for functions, add newline after return type
431.1SwizAlwaysBreakAfterReturnType: TopLevelDefinitions
441.1Swiz# align structure elements to the right
451.1SwizAlignArrayOfStructures: Right
46