" vimrc by digiter@126.com
" General
set encoding=utf-8 " text encoding
set nocompatible " not compatible vith vi
set autoread " auto load file modified outside
filetype plugin indent on " indent configure depend on filetype
syntax on " highlight syntax
color desert
" search and match
set incsearch " increasing search
" text formatting
set nowrap " no wrap lines
set number " show line numbers
set shiftwidth=4 " tab width
autocmd FileType c,cpp set noexpandtab " when filetype = c or cpp
" Compile and Run
map <C-F9> :call Compile()<CR>
function Compile()
execute "silent! w"
execute "!g++ % -o \%<"
endfunc
map <C-F10> :call Run()<CR>
function Run()
execute "!./%<"
endfunc
" Default code
map <F3> :call Header()<CR>
function Header()
let head = [
\ '/*',
\ ' * Author: rush',
\ ' * Creation Time: '.strftime('%Y-%m-%d %T'),
\ ' * File Name: '.expand('%'),
\ ' */',
\ '#include <cstdio>',
\ '#include <cstring>',
\ '#include <cmath>',
\ '#include <cstdlib>',
\ '#include <iostream>',
\ '#include <algorithm>',
\ '#include <vector>',
\ '#include <map>',
\ '#include <set>',
\ '#include <string>',
\ '#define OUT(x) cout << #x << ": " << (x) << endl',
\ '#define SZ(x) ((int)x.size())',
\ '#define FOR(i, n) for (int i = 0; i < (n); ++i)',
\ 'using namespace std;',
\ 'typedef long long LL;',
\ '',
\ 'int main() {',
\ ' return 0;',
\ '}']
call append(0, head)
endfunc
vimrc备份
最新推荐文章于 2022-10-04 17:08:09 发布