vimrc: add augroup clang_format
This commit is contained in:
parent
5ad78adc45
commit
c471524880
19
.vim/vimrc
19
.vim/vimrc
@ -292,6 +292,25 @@ let g:deoplete#enable_at_startup = 0
|
|||||||
exec 'source ' . escape(expand('~/.vim'),' ') . '/' . 'deoplete.vimrc.vim'
|
exec 'source ' . escape(expand('~/.vim'),' ') . '/' . 'deoplete.vimrc.vim'
|
||||||
|
|
||||||
|
|
||||||
|
" clang-format
|
||||||
|
let g:clang_format#auto_format=0
|
||||||
|
let g:clang_format#detect_style_file=1
|
||||||
|
augroup clang_format
|
||||||
|
autocmd!
|
||||||
|
autocmd FileType c,cpp,proto nnoremap <buffer><Leader>cf :<C-u>ClangFormat<cr>
|
||||||
|
autocmd FileType c,cpp,proto vnoremap <buffer><Leader>cf :ClangFormat<cr>
|
||||||
|
|
||||||
|
function! Formatonsave()
|
||||||
|
" alternative function to clang-format#auto_format param
|
||||||
|
if exists(':ClangFormat')
|
||||||
|
let l:formatdiff = 1
|
||||||
|
" pyf /usr/share/clang/clang-format.py
|
||||||
|
ClangFormat
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
|
||||||
let g:livepreview_cursorhold_recompile = 0
|
let g:livepreview_cursorhold_recompile = 0
|
||||||
let g:livepreview_previewer = 'evince'
|
let g:livepreview_previewer = 'evince'
|
||||||
|
Loading…
Reference in New Issue
Block a user