commit e068c18f247147a4322ea79933b07cbdb147f2ce
parent 51e19ec2c2763302470da19c0e7a8306b3e5f1f1
Author: Chris Bracken <chris@bracken.jp>
Date: Sat, 23 Feb 2019 13:18:13 -0800
Add clang-format plugin
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/.vim/vimrc b/.vim/vimrc
@@ -5,6 +5,7 @@ filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
+Plugin 'rhysd/vim-clang-format'
Plugin 'spacehi.vim' " Highlight bad whitespace
" Language support
@@ -37,7 +38,10 @@ noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
-" Map clang-format
+" Map clang-format to <Leader>cf
+autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
+autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
+
map <C-K> :call ClangFormat()<cr>
imap <C-K> <ESC>:call ClangFormat()<cr>