算法竞赛向 Vim 配置

先只贴一份配置,详细内容咕了

平时用

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
source $VIMRUNTIME/defaults.vim
set nu ts=4 sw=4 ai cindent si acd ar aw spr sb mouse=a
let mapleader = "\<space>"

filetype plugin indent on

inoremap <tab> <right>
inoremap <s-tab> <tab>
inoremap jj <esc>
inoremap ' ''<left>
inoremap " ""<left>
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap {<cr> {<cr>}<esc>O

map <c-a> ggVG"+y
map <c-x> ggVGd

nnoremap ' `

" window
map <leader>vs :vsplit<cr>:vertical resize 60<cr>
map <leader>s :split<cr>
map <leader>h <c-w>h
map <leader>j <c-w>j
map <leader>k <c-w>k
map <leader>l <c-w>l

" explorer
let g:netrw_winsize=12
let g:netrw_banner=0
map <c-e> :Lexplore<cr><c-w>l

" tab
map <leader>p :tabp<cr>
map <leader>n gt
map <leader>t :tabnew<cr>

map <f9> :w<cr>:!g++ -g -O2 -Wall -Wextra -Wshadow -Wconversion -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS -ggdb3 -fsanitize=undefined,address % -o %< && time ./%<<cr>
map <f8> :w<cr>:!g++ -O2 -std=c++14 % -o %< && time ./%<<cr>

" snippets
nnoremap <leader>cf :r ~/oi/template/codeforces.cpp<cr>:%s/codeforces/\=expand('%:r')/g<cr>:11<cr>$mb:10<cr>mak
nnoremap <leader>bf :r ~/oi/template/basicframe.cpp<cr>:%s/basicframe/\=expand('%:r')/g<cr>:13<cr>$mb:7<cr>mak


call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
call plug#end()

colorscheme gruvbox

" background transparent
autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE

赛时用

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
source $VIMRUNTIME/defaults.vim
set nu ts=4 sw=4 ai cindent si acd ar aw spr sb mouse=a
let mapleader = "\<space>"
filetype indent on

inoremap <tab> <right>
inoremap <s-tab> <tab>
inoremap jj <esc>
inoremap ' ''<left>
inoremap " ""<left>
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap {<cr> {<cr>}<esc>O

map<c-e> :Lexplore<cr><c-w>l

map<leader>vs :vsplit<cr>
map<leader>s :split<cr>

map<leader>p :tabp<cr>
map<leader>n gt
map<leader>t :tabnew<cr>

map<f9> :!g++ -g -O2 -Wall -Wextra -Wshadow -Wconversion -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS -ggdb3 -fsanitize=undefined,address % -o %< && time ./%<<cr>
map<f8> :!g++ -O2 -std=c++14 % -o %< && time ./%<<cr>

nnoremap <leader>bf :r ~/bf.cpp<cr>