Skip to content

Commit c4d2ae2

Browse files
authored
Merge pull request #5 from laelath/formatting
Move project to clang-format
2 parents bf7a055 + 690446a commit c4d2ae2

File tree

4 files changed

+275
-137
lines changed

4 files changed

+275
-137
lines changed

.clang-format

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: DontAlign
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: AllDefinitions
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: MultiLine
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
AfterExternBlock: false
33+
BeforeCatch: false
34+
BeforeElse: false
35+
IndentBraces: false
36+
SplitEmptyFunction: true
37+
SplitEmptyRecord: true
38+
SplitEmptyNamespace: true
39+
BreakBeforeBinaryOperators: NonAssignment
40+
BreakBeforeBraces: Linux
41+
BreakBeforeInheritanceComma: false
42+
BreakInheritanceList: BeforeColon
43+
BreakBeforeTernaryOperators: true
44+
BreakConstructorInitializersBeforeComma: false
45+
BreakConstructorInitializers: BeforeColon
46+
BreakAfterJavaFieldAnnotations: false
47+
BreakStringLiterals: false
48+
ColumnLimit: 80
49+
CommentPragmas: '^ IWYU pragma:'
50+
CompactNamespaces: false
51+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
52+
ConstructorInitializerIndentWidth: 4
53+
ContinuationIndentWidth: 8
54+
Cpp11BracedListStyle: true
55+
DerivePointerAlignment: false
56+
DisableFormat: false
57+
ExperimentalAutoDetectBinPacking: false
58+
FixNamespaceComments: true
59+
ForEachMacros:
60+
- foreach
61+
- Q_FOREACH
62+
- BOOST_FOREACH
63+
IncludeBlocks: Preserve
64+
IncludeCategories:
65+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
66+
Priority: 2
67+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
68+
Priority: 3
69+
- Regex: '.*'
70+
Priority: 1
71+
IncludeIsMainRegex: '(Test)?$'
72+
IndentCaseLabels: false
73+
IndentPPDirectives: None
74+
IndentWidth: 8
75+
IndentWrappedFunctionNames: false
76+
JavaScriptQuotes: Leave
77+
JavaScriptWrapImports: true
78+
KeepEmptyLinesAtTheStartOfBlocks: true
79+
MacroBlockBegin: ''
80+
MacroBlockEnd: ''
81+
MaxEmptyLinesToKeep: 1
82+
NamespaceIndentation: None
83+
ObjCBinPackProtocolList: Auto
84+
ObjCBlockIndentWidth: 2
85+
ObjCSpaceAfterProperty: false
86+
ObjCSpaceBeforeProtocolList: true
87+
PenaltyBreakAssignment: 2
88+
PenaltyBreakBeforeFirstCallParameter: 19
89+
PenaltyBreakComment: 300
90+
PenaltyBreakFirstLessLess: 120
91+
PenaltyBreakString: 1000
92+
PenaltyBreakTemplateDeclaration: 10
93+
PenaltyExcessCharacter: 1000000
94+
PenaltyReturnTypeOnItsOwnLine: 60
95+
PointerAlignment: Right
96+
ReflowComments: true
97+
SortIncludes: true
98+
SortUsingDeclarations: true
99+
SpaceAfterCStyleCast: false
100+
SpaceAfterTemplateKeyword: true
101+
SpaceBeforeAssignmentOperators: true
102+
SpaceBeforeCpp11BracedList: false
103+
SpaceBeforeCtorInitializerColon: true
104+
SpaceBeforeInheritanceColon: true
105+
SpaceBeforeParens: ControlStatements
106+
SpaceBeforeRangeBasedForLoopColon: true
107+
SpaceInEmptyParentheses: false
108+
SpacesBeforeTrailingComments: 1
109+
SpacesInAngles: false
110+
SpacesInContainerLiterals: true
111+
SpacesInCStyleCastParentheses: false
112+
SpacesInParentheses: false
113+
SpacesInSquareBrackets: false
114+
Standard: Cpp11
115+
TabWidth: 8
116+
UseTab: Always
117+
...
118+

README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ following options:
6262
### Scrollbar
6363
For a scrollbar, set the `use-scrollbar` setting in the `[Misc]` section to `true`.
6464

65-
### Vim
66-
For unknown reasons, vim does not color every line correctly. To fix this, add
67-
`set t_ut=` in your .vimrc. In addition to that, add `set termguicolors` to your
68-
.vimrc to add TrueColor support.
65+
## Miscellaneous
66+
### Weird Colors in Vim
67+
For unknown reasons, Vim does not color every line correctly. To fix this, add
68+
`set t_ut=` in your `.vimrc`. In addition to that, add `set termguicolors` to your
69+
`.vimrc` to add TrueColor support.
70+
71+
### Contributing
72+
## Formatting
73+
This project is formatted using [clang-format](https://clang.llvm.org/docs/ClangFormat.html). Please
74+
run this command on your code before committing.

config.h

+17-16
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,31 @@
2727
*/
2828

2929
/* Terminal emulation (value of $TERM) (default: xterm) */
30-
#define TERMINFO "xterm-256color"
30+
#define TERMINFO "xterm-256color"
3131

32-
#define DYNAMIC_WINDOW_TITLE // uncomment to enable window_title_cb
33-
#define URGENT_ON_BELL // uncomment to enable window_urgency_hint_cb
34-
#define SCROLLBACK_LINES 10000
32+
#define DYNAMIC_WINDOW_TITLE // uncomment to enable window_title_cb
33+
#define URGENT_ON_BELL // uncomment to enable window_urgency_hint_cb
34+
#define SCROLLBACK_LINES 10000
3535
#define SEARCH_WRAP_AROUND TRUE
36-
#define AUDIBLE_BELL FALSE
37-
#define VISIBLE_BELL FALSE
36+
#define AUDIBLE_BELL FALSE
37+
#define VISIBLE_BELL FALSE
3838

39-
/* One of VTE_CURSOR_SHAPE_BLOCK, VTE_CURSOR_SHAPE_IBEAM, VTE_CURSOR_SHAPE_UNDERLINE */
40-
#define CURSOR_SHAPE VTE_CURSOR_SHAPE_BLOCK
39+
/* One of VTE_CURSOR_SHAPE_BLOCK, VTE_CURSOR_SHAPE_IBEAM,
40+
* VTE_CURSOR_SHAPE_UNDERLINE */
41+
#define CURSOR_SHAPE VTE_CURSOR_SHAPE_BLOCK
4142

4243
/* One of VTE_CURSOR_BLINK_SYSTEM, VTE_CURSOR_BLINK_ON, VTE_CURSOR_BLINK_OFF */
43-
#define CURSOR_BLINK VTE_CURSOR_BLINK_OFF
44+
#define CURSOR_BLINK VTE_CURSOR_BLINK_OFF
4445

4546
/* Selection behavior for double-clicks */
4647
#define WORD_CHARS "-A-Za-z0-9:./?%&#_=+@~"
4748

4849
/* Regular expression matching urls */
49-
#define SPECIAL_CHARS "[[:alnum:]\\Q+-_,?;.:/!%$^*&~#=()\\E]"
50-
#define SCHEME "(?:[[:alpha:]][+-.[:alpha:]]*://)"
51-
#define USERINFO "(?:[[:alnum:]]+(?:" SPECIAL_CHARS "+)?\\@)?"
52-
#define HOST "(?:(?:[[:alnum:]-]+\\.)*[[:alpha:]]{2,})"
53-
#define PORT "(?:\\:[[:digit:]]{1,5})?"
54-
#define URLPATH "(?:/" SPECIAL_CHARS "*)?"
50+
#define SPECIAL_CHARS "[[:alnum:]\\Q+-_,?;.:/!%$^*&~#=()\\E]"
51+
#define SCHEME "(?:[[:alpha:]][+-.[:alpha:]]*://)"
52+
#define USERINFO "(?:[[:alnum:]]+(?:" SPECIAL_CHARS "+)?\\@)?"
53+
#define HOST "(?:(?:[[:alnum:]-]+\\.)*[[:alpha:]]{2,})"
54+
#define PORT "(?:\\:[[:digit:]]{1,5})?"
55+
#define URLPATH "(?:/" SPECIAL_CHARS "*)?"
5556

56-
const char * const url_regex = SCHEME USERINFO HOST PORT URLPATH "(?<!\\.)";
57+
const char *const url_regex = SCHEME USERINFO HOST PORT URLPATH "(?<!\\.)";

0 commit comments

Comments
 (0)