vimrc: add augroup clang_format

This commit is contained in:
surtur 2022-10-30 02:56:59 +01:00
parent 5ad78adc45
commit c471524880
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -292,6 +292,25 @@ let g:deoplete#enable_at_startup = 0
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_previewer = 'evince'