-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.lvimrc
54 lines (46 loc) · 2.8 KB
/
.lvimrc
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
" Set makeprg with required warning flags for CP
" TODO: If you ever make changes the flags, please recompile the stdc++.h
set makeprg=g++-14\ -std=c++17\ -I\ $CCTEMPLATEPATH/\ -Wall\ -Wextra\ -Wshadow\ -Wconversion\ -DDEBUG\ %\ -o\ %:r
" Compile and run the code inside vim only
nnoremap <Leader>g :w<CR>:Make<CR>
nnoremap <Leader>u :vsplit %:h/test<CR>
nnoremap <Leader>f :!clang-format -i %:p<CR>
nnoremap <Leader>r :vertical terminal ++shell ./%:r < %:h/test <CR>
nnoremap <Leader>p :vertical terminal ++shell pbpaste <bar> ./%:r <CR>
nnoremap <Leader>P :vertical terminal ++shell pbpaste > %:h/test; ./%:r < %:h/test<CR>
" Add some marks in my code base
" This hardcoding of mark is bad at line 38. It assumes my imports will not be
" there. let's change it.
nnoremap <Leader>m :/void solve<CR>GNjmskkkme`s:nohlsearch<CR>zz
" adding templates for Competitive
iabbrev trmq <ESC>ma'e:-1read $CCTEMPLATEPATH/rmq.h<CR>`a
iabbrev tsparse <ESC>ma'e:-1read $CCTEMPLATEPATH/sparse.h<CR>`a
iabbrev tsuffix <ESC>ma'e:-1read $CCTEMPLATEPATH/suffix_array.h<CR>`a
iabbrev tdsu <ESC>ma'e:-1read $CCTEMPLATEPATH/dsu.h<CR>`a
iabbrev tbigint <ESC>ma'e:-1read $CCTEMPLATEPATH/bigint.h<CR>`a
iabbrev tmodint <ESC>ma'e:-1read $CCTEMPLATEPATH/modint.h<CR>`a
iabbrev tsegtree <ESC>ma'e:-1read $CCTEMPLATEPATH/segtree.h<CR>`a
iabbrev tsegtreelazy <ESC>ma'e:-1read $CCTEMPLATEPATH/segtree_lazy.h<CR>`a
iabbrev tcomb <ESC>ma'e:-1read $CCTEMPLATEPATH/combination.h<CR>`a
iabbrev tpset <ESC>ma'e:-1read $CCTEMPLATEPATH/policy_set.h<CR>`a
iabbrev tptree <ESC>ma'e:-1read $CCTEMPLATEPATH/policy_tree.h<CR>`a
iabbrev tprime <ESC>ma'e:-1read $CCTEMPLATEPATH/prime.h<CR>`a
iabbrev tdivisor <ESC>ma'e:-1read $CCTEMPLATEPATH/divisor.h<CR>`a
iabbrev tdebug <ESC>ma'e:-1read $CCTEMPLATEPATH/debug.h<CR>`a
iabbrev tfunc <ESC>ma'e:-1read $CCTEMPLATEPATH/y_combinator.h<CR>`ak
iabbrev tgraph <ESC>ma'e:-1read $CCTEMPLATEPATH/graph.h<CR>`ak
iabbrev ttarjan <ESC>ma'e:-1read $CCTEMPLATEPATH/tarjan.h<CR>:-1read $CCTEMPLATEPATH/graph.h<CR>`ak
iabbrev ttemplate <ESC>:-1read $CCTEMPLATEPATH/solution.cpp<CR>:40<CR>
" Insert cin for the variables in current line
nnoremap <Leader>i yyp^cwcin,<ESC>:.s/,/ >>/g<CR><ESC>:nohlsearch<CR>o
" Insert cin for Arrays
" You can't use :Yanks here.
" We are disabling this features because my mapping breaks with it enabled.
" I use this mapping more than I use :Yanks during competitive
let g:yoinkIncludeDeleteOperations=0
let g:yoinkSyncNumberedRegisters=0
nnoremap <Leader>o yypk^f(lyi(orep(i, <ESC>pa){<ESC>jv>^df icin, <ESC>:.s/(/\[/g<CR>:.s/)/\]/g<CR>:;.s/,/ >>/g<CR>:.s/\[<C-r>0/\[i/g<CR><ESC>o}<ESC>o
" Change to single TC
nnoremap <Leader>s mt's/fastio<CR>2jd/return<CR>kosolve();<CR><ESC>:nohlsearch<CR>`t
" I/O for USACO
nnoremap <Leader>a mt's/fastio<CR>:-1read $CCTEMPLATEPATH/usaco.h<CR>:%s/problemname/\=expand('%:p:h:t')/g<CR>:nohlsearch<CR>`t