@@ -22,59 +22,34 @@ set tags+=~/.vim/tags/cpp
22
22
23
23
" }}}
24
24
25
- " commands {{{
25
+ " filetype keymaps {{{
26
+
26
27
" variables:
27
28
if " googletest" == &ft
28
- let gtestflags = " -lgtest -lgtest_main "
29
+ let b: gtestflags = " -lgtest -lgtest_main "
29
30
else
30
- let gtestflags = " "
31
+ let b: gtestflags = " "
31
32
endif
32
33
33
34
if " c" == &ft
34
- let cc = " gcc"
35
+ let b: cc = " gcc"
35
36
else
36
- let cc = " g++"
37
+ let b: cc = " g++"
37
38
endif
38
39
39
- let publicflags = " -g $(~/.vim/bin/syntasticFlags) "
40
+ " Compile:
41
+ nnoremap <buffer> <silent> <F7> :echo "Compiling ..." <cr> :echo system(b:cc.b:gtestflags." -o ".expand("%:t:r")." ".expand("%")) <cr>
40
42
41
- " create ctags
42
- command Ctags : wa | :echo system (" ctags -R --c++-kinds=+px --fields=+iaS --extra=+q . " )
43
+ " Run:
44
+ nnoremap <buffer> <silent> <F6> :echo system(" ./".expand("%:t:r")." 2>&1") <cr>
43
45
44
- " compile single file
45
- if filereadable (" GNUmakefile" ) || filereadable (" makefile" ) || filereadable (" Makefile" )
46
- command Compile :make
47
- else
48
- command Compile :echo system (cc .gtestflags.publicflags." -o " .expand (" %:t:r" )." " .expand (" %" ))
49
- endif
46
+ nnoremap <buffer> <silent> ,, :cw 8<cr>
47
+ nnoremap <buffer> <silent> ,! :ccl<cr>
50
48
51
- " run single file
52
- command Run :echo system (" ./" .expand (" %:t:r" )." 2>&1" )
53
- " }}}
54
-
55
- " filetype keymaps {{{
56
- nnoremap <F2> :Ctags<cr>
57
- nnoremap <F6> :Run<cr>
58
- nnoremap <F7> :Compile<cr>
59
49
" }}}
60
50
61
51
" plugin configurations: {{{
62
-
63
- " OmniCppComplete: {{{
64
- let OmniCpp_ShowPrototypeInAbbr = 1
65
- let OmniCpp_SelectFirstItem = 2
66
- let OmniCpp_MayCompleteScope = 1
67
- let OmniCpp_MayCompleteArrow = 1
68
- let OmniCpp_MayCompleteDot = 1
69
- let OmniCpp_NamespaceSearch = 2
70
52
" auto-close Scratch when selected
71
53
autocmd CursorMovedI * if pumvisible () == 0 |pclose |endif
72
54
autocmd InsertLeave * if pumvisible () == 0 |pclose |endif
73
55
" }}}
74
- " syntastic: {{{
75
- let g: syntastic_cpp_compiler_options = ' -Wall '
76
- let g: syntastic_cpp_check_header = 1
77
- let g: syntastic_cpp_config_file = ' .syntastic_cpp_config'
78
- " }}}
79
-
80
- " }}}
0 commit comments