aboutsummaryrefslogtreecommitdiff
path: root/stow/vim/dot-vim/ftplugin/cpp/cpp.vim
blob: e2072c164e2b9cf33d6160a18c1360fb81c679a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
" ~/.vim/ftplugin/cpp/cpp.vim
" C++-specific vim configuration

let mapleader = " "

" Column marker: 80 characters
match ColorColumn /\%81v/
setlocal textwidth=80

nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/cpp/cpp.vim<CR>
nnoremap <buffer> <leader>E :Errors<CR>

nnoremap <buffer> <leader>c :w<CR>:!g++ "%"; ./a.out<Space>

nnoremap <buffer> gd :YcmCompleter GoTo<CR>
nnoremap <buffer> gr :YcmCompleter GoToReferences<CR>
nnoremap <buffer> gh :YcmCompleter GetType<CR>
nnoremap <buffer> gD :YcmCompleter GetDoc<CR>
nnoremap <buffer> gR :YcmCompleter RefactorRename<Space>
nnoremap <buffer> <leader>fi :YcmCompleter FixIt<CR>
nnoremap <buffer> <leader>e :YcmDiags<CR>

nnoremap <buffer> <leader>temp :-1r ~/.vim/ftplugin/cpp/snips/template.txt<CR>Gdd?<+++><CR>cf>

let mapleader = ","

inoremap <buffer> <leader>if if (<+++>) {<CR><++><CR>}?<+++><CR>cf>
inoremap <buffer> <leader>for for (<+++>; <++>; <++>) {<CR><++><CR>}?<+++><CR>cf>