aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--src/.clang-format12
-rw-r--r--src/nvim/version.c2
3 files changed, 20 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ed9aa3cd81..c1b9d50143 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -68,6 +68,11 @@ For new code, please run [`clint.py`][clint] to detect style errors. It is not
perfect and may have false positives and negatives. To have `clint.py` ignore
certain special cases, put `// NOLINT` at the end of the line.
+We also provide a configuration file for [`clang-format` and
+`git-clang-format`][clang-format], which can be used to format code according
+to the style guidelines. Be aware this formatting method might need user
+supervision.
+
#### Commit guidelines
The purpose of these guidelines is to *make reviews easier* and make the VCS logs more valuable.
@@ -93,6 +98,7 @@ The purpose of these guidelines is to *make reviews easier* and make the VCS log
[cla]: https://docs.google.com/forms/d/1u54bpbwzneDIRltFx1TGi2evKxY3w0cOV3vlpj8DPbg/viewform
[clint]: clint.py
+[clang-format]: http://clang.llvm.org/docs/ClangFormat.html
[entry]: https://github.com/neovim/neovim/issues?labels=entry-level&state=open
[imperative]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style]: http://neovim.org/develop/style-guide.xml
diff --git a/src/.clang-format b/src/.clang-format
new file mode 100644
index 0000000000..35e545ac4b
--- /dev/null
+++ b/src/.clang-format
@@ -0,0 +1,12 @@
+BasedOnStyle: llvm
+Language: Cpp
+ColumnLimit: 80
+IndentWidth: 2
+TabWidth: 2
+UseTab: Never
+IndentCaseLabels: true
+BreakBeforeBraces: Linux
+AlignEscapedNewlinesLeft: false
+AllowShortFunctionsOnASingleLine: false
+SpacesBeforeTrailingComments: 2
+PenaltyReturnTypeOnItsOwnLine: 200
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 3aa8ea911c..afafc0b1bc 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -177,6 +177,7 @@ static char *(features[]) = {
NULL
};
+// clang-format off
static int included_patches[] = {
//591 NA
//590,
@@ -771,6 +772,7 @@ static int included_patches[] = {
1,
0
};
+// clang-format on
/// Place to put a short description when adding a feature with a patch.
/// Keep it short, e.g.,: "relative numbers", "persistent undo".