From 68ef92751b64aa23d35a6ee5ed5304e47ad0d143 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Wed, 11 Jul 2018 17:20:21 +0200 Subject: [PATCH] Compute clang_style when reading the buffer --- .vimrc | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/.vimrc b/.vimrc index 3804271..cca0d78 100644 --- a/.vimrc +++ b/.vimrc @@ -186,28 +186,13 @@ augroup Binary au BufWritePost *.bin set nomod | endif augroup END -if has("autocmd") - " detect indentation see http://www.freehackers.org/Indent_Finder - if &expandtab - autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' ) - else - autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default tab --default-size ' .&tabstop .' "' . expand('%') . '"' ) - endif -else - " auto-indent - set autoindent - " smart-indent - set smartindent - " C-indent - "set cindent - " indent-expr - "set indentexpr "" -endif - +" detect indentation see http://www.freehackers.org/Indent_Finder if &expandtab - let g:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AlignTrailingComments: true, UseTab: Never, BreakBeforeBraces: Linux, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 95, IndentWidth: " . &tabstop ."}" + autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' ) + autocmd BufReadPost /* let g:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: Never}" else - let g:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AlignTrailingComments: true, UseTab: Always, BreakBeforeBraces: Linux, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 95, IndentWidth: " . &tabstop ."}" + autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default tab --default-size ' .&tabstop .' "' . expand('%') . '"' ) + autocmd BufReadPost /* let g:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: ForContinuationAndIndentation}" endif map :pyf ~/.vim/syntax/clang-format.py