Compute clang_style when reading the buffer
This commit is contained in:
parent
f75d291791
commit
68ef92751b
25
.vimrc
25
.vimrc
@ -186,28 +186,13 @@ augroup Binary
|
|||||||
au BufWritePost *.bin set nomod | endif
|
au BufWritePost *.bin set nomod | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
if has("autocmd")
|
" detect indentation see http://www.freehackers.org/Indent_Finder
|
||||||
" 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
|
|
||||||
|
|
||||||
if &expandtab
|
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
|
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
|
endif
|
||||||
|
|
||||||
map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR>
|
map <C-K> :pyf ~/.vim/syntax/clang-format.py<CR>
|
||||||
|
Loading…
Reference in New Issue
Block a user