0
点赞
收藏
分享

微信扫一扫

linux - vimrc


"peerslee {
set foldmethod=indent

filetype on
filetype plugin on
filetype indent on

autocmd BufNewFile *.py exec ":call SetTitleForPy()"
func SetTitleForPy()
call setline(1, "\"\"\"")
call append(line("."), "")
call append(line(".")+1, "@Author: plli")
call append(line(".")+2, "@Mail: lipenglin@sensorsdata.cn")
call append(line(".")+3, "@Time: ".strftime("%x"))
call append(line(".")+4, "")
call append(line(".")+5, "\"\"\"")
endfunc
autocmd BufNewFile * normal G

autocmd BufNewFile *.cc exec ":call SetTitleForCc()"
func SetTitleForCc()
call setline(1, "/*")
call append(line("."), " *")
call append(line(".")+1, " * @Author: plli")
call append(line(".")+2, " * @Mail: lipenglin@sensorsdata.cn")
call append(line(".")+3, " * @Time: ".strftime("%x"))
call append(line(".")+4, " *")
call append(line(".")+5, " */")
call append(line(".")+6, "")
call append(line(".")+7, "#include<iostream>")
call append(line(".")+8, "")
call append(line(".")+9, "using namespace std;")
call append(line(".")+10, "")
endfunc
autocmd BufNewFile * normal G

map <F5> :call CompileAndRun()<CR>
func! CompileAndRun()
exec "w"
if &filetype == 'python'
exec "!time python3.7 %"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'cpp'
exec "!g++ % -std=c++11 -o .out/%<"
exec "!time .out/%<"
endif
endfunc

map <F7> :call PyTest()<CR>
func! PyTest()
exec "w"
if &filetype == 'python'
exec "!time pytest %"
endif
endfunc

map <F8> :call Compile()<CR>
func! Compile()
exec "w"
exec "!g++ % -std=c++11 -g -o .out/%<"
"exec "!gdb ./%<"
endfunc

map <F12> :call MKDir()<CR>
func! MKDir()
exec "w"
if &filetype == 'cpp'
exec "!mkdir .out"
endif
endfunc

"}

set ts=4 
set expandtab


举报

相关推荐

0 条评论