"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""新文件标题
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
let l = 7
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: QWX")
call append(line(".")+2, " > Mail: ")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
if expand("%:e") == 'cpp'
let l = l + 1 | call setline(l,"")
let l = l + 1 | call setline(l,"//{{{ #include")
let l = l + 1 | call setline(l,"#include<iostream>")
let l = l + 1 | call setline(l,"#include<cstdio>")
let l = l + 1 | call setline(l,"#include<algorithm>")
let l = l + 1 | call setline(l,"#include<vector>")
let l = l + 1 | call setline(l,"#include<cmath>")
let l = l + 1 | call setline(l,"#include<queue>")
let l = l + 1 | call setline(l,"#include<map>")
let l = l + 1 | call setline(l,"#include<set>")
let l = l + 1 | call setline(l,"#include<string>")
let l = l + 1 | call setline(l,"#include<cstring>")
let l = l + 1 | call setline(l,"#include<complex>")
let l = l + 1 | call setline(l,"#include<cassert>")
let l = l + 1 | call setline(l,"//#include<bits/stdc++.h>")
let l = l + 1 | call setline(l,"#define vi vector<int>")
let l = l + 1 | call setline(l,"#define pii pair<int,int>")
let l = l + 1 | call setline(l,"#define mp make_pair")
let l = l + 1 | call setline(l,"#define pb push_back")
let l = l + 1 | call setline(l,"#define fi first")
let l = l + 1 | call setline(l,"#define se second")
let l = l + 1 | call setline(l,"#define pw(x) (1ll << (x))")
let l = l + 1 | call setline(l,"#define sz(x) ((int)(x).size())")
let l = l + 1 | call setline(l,"#define all(x) (x).begin(),(x).end()")
let l = l + 1 | call setline(l,"#define rep(i,l,r) for(int i=(l);i<(r);i++)")
let l = l + 1 | call setline(l,"#define per(i,r,l) for(int i=(r);i>=(l);i--)")
let l = l + 1 | call setline(l,"#define FOR(i,l,r) for(int i=(l);i<=(r);i++)")
let l = l + 1 | call setline(l,"#define cl(a,b) memset(a,b,sizeof(a))")
let l = l + 1 | call setline(l,"#define fastio ios::sync_with_stdio(false);cin.tie(0);")
let l = l + 1 | call setline(l,"#define lson l , mid , ls")
let l = l + 1 | call setline(l,"#define rson mid + 1 , r , rs")
let l = l + 1 | call setline(l,"#define INF 0x3f3f3f3f")
let l = l + 1 | call setline(l,"#define LINF 0x3f3f3f3f3f3f3f3f")
let l = l + 1 | call setline(l,"#define ll long long")
let l = l + 1 | call setline(l,"#define ull unsigned long long")
let l = l + 1 | call setline(l,"#define dd(x) cout << #x << " = " << (x) << "," ")
let l = l + 1 | call setline(l,"#define de(x) cout << #x << " = " << (x) << "\n" ")
let l = l + 1 | call setline(l,"#define endl "\n"")
let l = l + 1 | call setline(l,"using namespace std;")
let l = l + 1 | call setline(l,"//}}}")
let l = l + 1 | call setline(l,"")
let l = l + 1 | call setline(l,"")
let l = l + 1 | call setline(l,"")
let l = l + 1 | call setline(l,"")
endif
"新建文件后,自动定位到文件末尾
endfunc
autocmd BufNewFile * normal G
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"键盘命令
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nu ai ci si mouse=a ts=4 sts=4 sw=4 fdm=marker clipboard=unnamed
syntax on expandtab autoindent
nmap<F2> : vs %<.in <CR>
nmap<F7> : !g++ % -o %< -std=c++11 <CR>
nmap<F8> : !clear && ./%< < %<.in <CR>
nmap<F9> : !clear && make %< <CR>
nmap<F3> : !gedit %<.cpp <CR>
colo evening
set nocompatible
set backspace=indent,eol,start
set guifont=Ubuntu Mono:h12