Adapt clang-format default behaviour
This commit is contained in:
parent
d897a89494
commit
f6af32126d
67
init.vim
67
init.vim
|
@ -306,13 +306,74 @@ call plug#end()
|
|||
" ===
|
||||
if g:use_clang_format == 1
|
||||
let g:clang_format#detect_style_file = 1
|
||||
let g:clang_format#enable_fallback_style = 0
|
||||
let g:clang_format#enable_fallback_style = 1
|
||||
|
||||
let g:clang_format#style = "Microsoft"
|
||||
let g:clang_format#style_options = {
|
||||
\ "BasedOnStyle" : "Microsoft",
|
||||
\ "AccessModifierOffset" : -4,
|
||||
\ "AlignAfterOpenBracket" : "Align",
|
||||
\ "AlignConsecutiveAssignments" : "false",
|
||||
\ "AlignConsecutiveDeclarations" : "false",
|
||||
\ "AlignEscapedNewlinesLeft" : "false",
|
||||
\ "AlignOperands" : "true",
|
||||
\ "AlignTrailingComments" : "false",
|
||||
\ "AllowAllParametersOfDeclarationOnNextLine" : "false",
|
||||
\ "AllowShortBlocksOnASingleLine" : "false",
|
||||
\ "AllowShortCaseLabelsOnASingleLine" : "false",
|
||||
\ "AllowShortFunctionsOnASingleLine" : "All",
|
||||
\ "AllowShortIfStatementsOnASingleLine" : "false",
|
||||
\ "AllowShortLoopsOnASingleLine" : "false",
|
||||
\ "AlwaysBreakAfterDefinitionReturnType" : "None",
|
||||
\ "AlwaysBreakAfterReturnType" : "None",
|
||||
\ "AlwaysBreakBeforeMultilineStrings" : "false",
|
||||
\ "AlwaysBreakTemplateDeclarations" : "true",
|
||||
\ "BinPackArguments" : "false",
|
||||
\ "BinPackParameters" : "false",
|
||||
\ "BreakAfterJavaFieldAnnotations" : "false",
|
||||
\ "BreakBeforeBinaryOperators" : "NonAssignment",
|
||||
\ "BreakBeforeBraces" : "Allman",
|
||||
\ "BreakBeforeTernaryOperators" : "true",
|
||||
\ "BreakConstructorInitializersBeforeComma" : "false",
|
||||
\ "BreakStringLiterals" : "false",
|
||||
\ "ColumnLimit" : 0,
|
||||
\ "ConstructorInitializerAllOnOneLineOrOnePerLine" : "true",
|
||||
\ "ConstructorInitializerIndentWidth" : 4,
|
||||
\ "ContinuationIndentWidth" : 4,
|
||||
\ "Cpp11BracedListStyle" : "false",
|
||||
\ "DerivePointerAlignment" : "false",
|
||||
\ "DisableFormat" : "false",
|
||||
\ "ExperimentalAutoDetectBinPacking" : "false",
|
||||
\ "IndentCaseLabels" : "true",
|
||||
\ "IndentWidth" : 4,
|
||||
\ "IndentWrappedFunctionNames" : "true",
|
||||
\ "KeepEmptyLinesAtTheStartOfBlocks" : "false",
|
||||
\ "Language" : "Cpp",
|
||||
\ "MaxEmptyLinesToKeep" : 1,
|
||||
\ "NamespaceIndentation" : "Inner",
|
||||
\ "PointerAlignment" : "Left",
|
||||
\ "ReflowComments" : "false",
|
||||
\ "SortIncludes" : "true",
|
||||
\ "SpaceAfterCStyleCast" : "true",
|
||||
\ "SpaceBeforeAssignmentOperators" : "true",
|
||||
\ "SpaceBeforeParens" : "ControlStatements",
|
||||
\ "SpaceInEmptyParentheses" : "false",
|
||||
\ "SpacesInAngles" : "false",
|
||||
\ "SpacesInCStyleCastParentheses" : "false",
|
||||
\ "SpacesInContainerLiterals" : "true",
|
||||
\ "SpacesInParentheses" : "false",
|
||||
\ "SpacesInSquareBrackets" : "false",
|
||||
\ "Standard" : "Cpp11",
|
||||
\ "TabWidth" : 4,
|
||||
\ "UseTab" : "Never" }
|
||||
|
||||
let g:clang_format#auto_format = 1
|
||||
let g:clang_format#auto_format_on_insert_leave = 0
|
||||
|
||||
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
|
||||
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
|
||||
|
||||
autocmd FileType c,cpp,objc let g:clang_format#auto_format = 1
|
||||
autocmd FileType c,cpp,objc let g:clang_format#auto_format_on_insert_leave = 0
|
||||
nmap <Leader>ct :ClangFormatAutoToggle<CR>
|
||||
endif
|
||||
" ===
|
||||
|
||||
|
|
Loading…
Reference in New Issue