diff --git a/.vim/vimrc b/.vim/vimrc index 4264243..7992f62 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -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 cf :ClangFormat + autocmd FileType c,cpp,proto vnoremap cf :ClangFormat + + 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'