aboutsummaryrefslogtreecommitdiff
path: root/files/vim/ftplugin
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-12-28 19:39:24 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-12-28 19:39:24 +0100
commit42e846b50a91e692558c9ba313fb88612cbd14ab (patch)
treeb21cc97d3737b8326802f5ad15db78c42ff4cafb /files/vim/ftplugin
parent950fa3cd6b5ec4d4d0d9741f8dfd93591f23559c (diff)
downloadconfigs-42e846b50a91e692558c9ba313fb88612cbd14ab.tar.gz
configs-42e846b50a91e692558c9ba313fb88612cbd14ab.zip
Created vim ftplugin for C++.
Diffstat (limited to 'files/vim/ftplugin')
-rw-r--r--files/vim/ftplugin/cpp/cpp.vim24
-rw-r--r--files/vim/ftplugin/cpp/snips/template.txt5
2 files changed, 29 insertions, 0 deletions
diff --git a/files/vim/ftplugin/cpp/cpp.vim b/files/vim/ftplugin/cpp/cpp.vim
new file mode 100644
index 0000000..6b4807d
--- /dev/null
+++ b/files/vim/ftplugin/cpp/cpp.vim
@@ -0,0 +1,24 @@
+" ~/.vim/ftplugin/cpp/cpp.vim
+" C++-specific vim configuration
+
+highlight Comment ctermfg=darkgreen
+
+" Column marker: 80 characters
+call matchadd('ColorColumn', '\%81v', 100)
+
+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> <leader>E :Errors<CR>
+
+nnoremap <buffer> <leader>gt :YcmCompleter GoTo<CR>
+nnoremap <buffer> <leader>gr :YcmCompleter GoToReferences<CR>
+nnoremap <buffer> <leader>gd :YcmCompleter GetDoc<CR>
+nnoremap <buffer> <leader>gT :YcmCompleter GetType<CR>
+nnoremap <buffer> <leader>fi :YcmCompleter FixIt<CR>
+nnoremap <buffer> <leader>e :YcmDiags<CR>
+
+inoremap <buffer> <leader>if if (<+++>) {<CR><++><CR>}?<+++><CR>cf>
+inoremap <buffer> <leader>for for (<+++>; <++>; <++>) {<CR><++><CR>}?<+++><CR>cf>
+nnoremap <buffer> <leader>temp :-1r ~/.vim/ftplugin/cpp/snips/template.txt<CR>Gdd?<+++><CR>cf>
diff --git a/files/vim/ftplugin/cpp/snips/template.txt b/files/vim/ftplugin/cpp/snips/template.txt
new file mode 100644
index 0000000..8479d26
--- /dev/null
+++ b/files/vim/ftplugin/cpp/snips/template.txt
@@ -0,0 +1,5 @@
+#include <iostream>
+
+int main() {
+ <+++>
+}