set guifont=Monaco\ 11 syntax on set number set showmatch set autoindent set smartindent set tabstop=2 set shiftwidth=2 set mouse=a set autoread set nowrap set hlsearch map <F5> : call Compile() <CR> func! Compile() exec 'w' exec '!g++ % -lm -Wall -std=c++98 -O2 -o %<' exec '!time ./%<' endfunc autocmd BufNewFile *.cpp,*.cc exec ":call SetTitle()" func SetTitle() call setline(1, "#include <bits/stdc++.h>") call append(line(".")+0, "using namespace std;") call append(line(".")+1, "") call append(line(".")+2, "int main() {") call append(line(".")+3, "#ifndef ONLINE_JUDGE") call append(line(".")+4, " freopen(\".in\", \"r\", stdin);") call append(line(".")+5, " freopen(\".out\", \"w\", stdout);") call append(line(".")+6, "#endif") call append(line(".")+7, "") call append(line(".")+8, " return 0;") call append(line(".")+9, "}") autocmd BufNewFile * normal G endfunc
来源:https://www.cnblogs.com/newbielyx/p/12214959.html