Skip to content

Commit eed7321

Browse files
committed
remove unnecessary plugin configurations, solve the command conflict between c/cpp/gtest and java
1 parent 07a7267 commit eed7321

File tree

2 files changed

+21
-60
lines changed

2 files changed

+21
-60
lines changed

ftplugin/cpp.vim

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,59 +22,34 @@ set tags+=~/.vim/tags/cpp
2222

2323
" }}}
2424

25-
" commands {{{
25+
" filetype keymaps {{{
26+
2627
" variables:
2728
if "googletest" == &ft
28-
let gtestflags = " -lgtest -lgtest_main "
29+
let b:gtestflags = " -lgtest -lgtest_main "
2930
else
30-
let gtestflags = ""
31+
let b:gtestflags = ""
3132
endif
3233

3334
if "c" == &ft
34-
let cc = "gcc"
35+
let b:cc = "gcc"
3536
else
36-
let cc = "g++"
37+
let b:cc = "g++"
3738
endif
3839

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>
4042
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>
4345
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>
5048
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>
5949
" }}}
6050

6151
" 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
7052
" auto-close Scratch when selected
7153
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
7254
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
7355
" }}}
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-
" }}}

ftplugin/java.vim

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,20 @@ set cindent " cindent
2020

2121
" }}}
2222

23-
" commands {{{
23+
" filetype keymaps {{{
2424

25-
" create ctags
26-
command Ctags :wa |:echo system("ctags -R --c++-kinds=+px --fields=+iaS --extra=+q .")
25+
" Compile:
26+
nnoremap <buffer> <silent> <F7> :echo "Compiling ..." <cr> :echo system("javac ".expand("%")) <cr>
2727
28-
" compile single file
29-
if filereadable("GNUmakefile") || filereadable("makefile") || filereadable("Makefile")
30-
command Compile :make
31-
else
32-
command Compile :echo system("javac ".expand("%"))
33-
endif
28+
" Run:
29+
nnoremap <buffer> <silent> <F6> :echo "Starting JVM ..." <cr> :echo system("java ".expand("%:t:r")." 2>&1") <cr>
3430
35-
" run single file
36-
command Run :echo system("java ".expand("%:t:r")." 2>&1")
37-
" }}}
38-
39-
" filetype keymaps {{{
4031
inoremap <C-p> System.out.println()<esc>i
41-
nnoremap <F2> :Ctags<cr>
42-
nnoremap <F6> :Run<cr>
43-
nnoremap <F7> :Compile<cr>
44-
" }}}
45-
46-
" plugin configurations: {{{
4732
48-
" syntastic: {{{
49-
let g:syntastic_java_javac_config_file_enabled = 1
50-
let g:syntastic_java_javac_config_file = '.syntastic_java_config'
5133
" }}}
5234

35+
" plugin configurations: {{{
36+
" auto-close Scratch when selected
37+
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
38+
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
5339
" }}}

0 commit comments

Comments
 (0)