]> git.rmz.io Git - dotfiles.git/blobdiff - vim/ftplugin/cpp.vim
vim: add clang-format plugin
[dotfiles.git] / vim / ftplugin / cpp.vim
index b98aee201b55bd53a2f4c19841c3539e782f7cd0..be1b64d268ce04f2e39a1bf5511204616dc74170 100644 (file)
@@ -15,10 +15,32 @@ setlocal cinoptions+=:0  " don't indent case labels
 let b:load_doxygen_syntax = 1
 
 augroup fswitch
-    au BufEnter *.h let b:fswitchdst  = 'cpp,c'
-    au BufEnter *.h let b:fswitchlocs = 'reg:/include/source/'
+    au BufEnter *.h   let b:fswitchdst  = 'cpp,c'
+    au BufEnter *.h   let b:fswitchlocs = 'reg:|include.*|source|'
+    au BufEnter *.cpp let b:fswitchdst  = 'h'
+    au BufEnter *.cpp let b:fswitchlocs = 'reg:|source|include/**|'
 augroup END
 
+nnoremap <buffer> gd :YcmCompleter GoTo<CR>
+nnoremap <buffer> <C-W>d :vs<CR>:YcmCompleter GoTo<CR>
+
+" format with =
+map <buffer> = <Plug>(operator-clang-format)
+vnoremap <buffer> = :ClangFormat<CR>
+" restore = mapping to g=
+nnoremap <buffer>g= =
+vnoremap <buffer>g= =
+
+setlocal errorformat=
+setlocal errorformat+=%f:%l:%c:\ %trror:\ %m
+setlocal errorformat+=%f:%l:%c:\ %tarning:\ %m
+setlocal errorformat+=%D%*\\a[%*\\d]:\ Entering\ directory\ [`']%f'
+setlocal errorformat+=%X%*\\a[%*\\d]:\ Leaving\ directory\ [`']%f'
+setlocal errorformat+=%D%*\\a:\ Entering\ directory\ [`']%f'
+setlocal errorformat+=%X%*\\a:\ Leaving\ directory\ [`']%f'
+setlocal errorformat+=%*[^[]\[%tRROR\]%m\ \[%f:%l\]
+setlocal errorformat+=%*[^[]\[%tARNING\]%m\ \[%f:%l\]
+
 setlocal foldmethod=syntax
 " set foldlevel according to number of matches of 'namespace' and 'class' not
 " containing ';'