vimrc for Competitive Programming

一个备份

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
set shell=/bin/bash
set cursorcolumn
set guifont=Ubuntu\ Mono\ 13
set cursorline
set nu ts=4 sw=4 cin
set softtabstop=4
map <F1> :call CRr()<CR>
func CRr()
exec "w"
exec "!clear && g++ % -std=c++11 -W -o a && ./a"
endfunc
imap {<CR> {<CR>}<C-O>O<left><right>
syn on

autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
if &filetype == 'cpp'
call setline(1, "#include <bits/stdc++.h>")
call append(line("."), "")
call append(line(".")+1, "using namespace std;")
call append(line(".")+2, "typedef long long ll;")
call append(line(".")+3, "")
call append(line(".")+4, "int main()")
call append(line(".")+5, "{")
call append(line(".")+6, " ")
call append(line(".")+7, " return 0;")
call append(line(".")+8, "}")
endif
endfunc

map <C-A> ggVG
vmap <C-c> "+y

set nobackup
set autoindent
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { {<CR>}<ESC>O
":inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
filetype plugin indent on
set completeopt=longest,menu
syntax enable
set background=light
colorscheme tomorrow-night-bright
hi Normal ctermfg=252 ctermbg=none
highlight LineNr ctermfg=white
highlight Normal ctermfg=white
set nocompatible " be iMproved, required