日常vim配置

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++11 -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
posted @ 2020-01-19 17:36  newbielyx  阅读(165)  评论(0编辑  收藏  举报