vimrc: fix expandtab

This commit is contained in:
Mathieu Maret 2018-07-11 18:18:42 +02:00
parent d694a515f6
commit f4fdbe044f
1 changed files with 11 additions and 7 deletions

18
.vimrc
View File

@ -185,14 +185,18 @@ augroup Binary
au BufWritePost *.bin set nomod | endif
augroup END
fu DetectIndent()
execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default space --default-size ' . &tabstop .' "' . expand('%') . '"' )
if &expandtab
let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: Never}"
else
let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: ForContinuationAndIndentation}"
endif
endfu
" 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('%') . '"' )
autocmd BufReadPost /* let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: Never}"
else
autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output --default tab --default-size ' .&tabstop .' "' . expand('%') . '"' )
autocmd BufReadPost /* let b:clang_style="{BasedOnStyle: LLVM, AlignConsecutiveAssignments: true, AllowShortFunctionsOnASingleLine: Empty, BreakBeforeBraces: Linux, BreakStringLiterals: false, ColumnLimit: 95, IndentCaseLabels: true, IndentWidth: " .&shiftwidth .", TabWidth: " .&tabstop .", UseTab: ForContinuationAndIndentation}"
endif
autocmd BufReadPost /* call DetectIndent()
map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR>
imap <C-K> <ESC>:pyf ~/.vim/syntax/clang-format.py<CR>i