From ad2cf234352d276461a5ce9e8db58cd4cd628ee4 Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Fri, 1 May 2026 16:01:40 +0200 Subject: [PATCH] fix(style): drop clang-format #39514 Problem: C formatting is enforced in CI via uncrustify, but when working on C code clangd formats on save via clang-format, forcing users to manually run `make formatc` after they're done. Solution: disable clang-format. --- .clang-format | 68 +--------------------------------------------- CONTRIBUTING.md | 7 ----- src/nvim/version.c | 2 -- 3 files changed, 1 insertion(+), 76 deletions(-) diff --git a/.clang-format b/.clang-format index 9f45ac32e2..e3845288a2 100644 --- a/.clang-format +++ b/.clang-format @@ -1,67 +1 @@ -BasedOnStyle: Google -Language: Cpp -ColumnLimit: 100 -IndentWidth: 2 -TabWidth: 8 -UseTab: Never -IndentCaseLabels: false -BreakBeforeBraces: Custom -AlignEscapedNewlinesLeft: false -AllowShortFunctionsOnASingleLine: false -AlignTrailingComments: true -SpacesBeforeTrailingComments: 2 -PenaltyReturnTypeOnItsOwnLine: 200 -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -BinPackParameters: true -BreakBeforeBinaryOperators: true -BreakBeforeTernaryOperators: true -ContinuationIndentWidth: 2 -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: No -AlwaysBreakTemplateDeclarations: No -AlignEscapedNewlines: DontAlign -BinPackArguments: true -BraceWrapping: - AfterClass: false - AfterControlStatement: false - AfterEnum: false - AfterFunction: true - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false -PointerAlignment: Right -SortIncludes: true -Cpp11BracedListStyle: false -IncludeCategories: - - Regex: '<[/[:alnum:].]+>' - Priority: 0 - - Regex: '^"(nvim|vim)/' - Priority: 1 - SortPriority: 1 - CaseSensitive: false -AlignConsecutiveMacros: AcrossEmptyLines -IndentPPDirectives: AfterHash -SpaceBeforeParens: ControlStatementsExceptControlMacros -PPIndentWidth: 1 -ForEachMacros: - - FOR_ALL_AUEVENTS - - FOR_ALL_AUPATS_IN_EVENT - - FOR_ALL_BUFFERS - - FOR_ALL_BUFFERS_BACKWARDS - - FOR_ALL_FRAMES - - FOR_ALL_QFL_ITEMS - - FOR_ALL_SIGNS_IN_BUF - - FOR_ALL_TABS - - FOR_ALL_TAB_WINDOWS - - FOR_ALL_WINDOWS_IN_TAB - - RBUFFER_EACH - - RBUFFER_EACH_REVERSE - - RBUFFER_UNTIL_EMPTY - - RBUFFER_UNTIL_FULL - - kl_iter +DisableFormat: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12722e88e6..f95c3aa3b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -214,13 +214,6 @@ make lint # or lintc, lintlua, lintquery, lintdoc setlocal formatprg=uncrustify\ -q\ -l\ C\ -c\ src/uncrustify.cfg\ --no-backup endif ``` -- There is also `.clang-format` which is "mostly" aligned with uncrustify. - To use the Nvim `gq` command with `clang-format`: - ```vim - if !empty(findfile('.clang-format', ';')) - setlocal formatprg=clang-format\ -style=file - endif - ``` ### Navigate diff --git a/src/nvim/version.c b/src/nvim/version.c index 8465cb13b0..5d34b6405a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -57,7 +57,6 @@ char *version_cflags = "Compilation: " NVIM_VERSION_CFLAGS; #include "version.c.generated.h" -// clang-format off static const int vim_versions[] = { 801, 802, 900, 901, 902 }; static const int num_patches[] = { 2331, 3825, 1582, 1630, 221 }; @@ -3962,7 +3961,6 @@ static const int *included_patchsets[] = { // 0 }, }; -// clang-format on /// Compares a version string to the current Nvim version. ///