commit de7a738614fc659c163615d614e386c4fcbd3fe1
parent 974d9c3d9165a456d530299624a2198696af0b43
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/vimrc b/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>