-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpp.vim
37 lines (32 loc) · 771 Bytes
/
cpp.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
vim9script
:112
def Run_CPP()
wa!
set makeprg=g++\ %
silent make
wincmd l
below terminal ./a.out
silent !rm a.out
set autoread
redraw!
cwindow
enddef
#copy your test case and just ctrl + t
#will clear and paste in input.txt and return you to main.cpp
def Past_Tests()
wincmd w
#startinsert
:%d
set autoread
set autowrite
#for native Linux
# silent !xclip -o clipboard > input.txt
#for WSL
silent !powershell.exe Get-Clipboard > input.txt
redraw!
wincmd h
enddef
nnoremap <buffer> <C-s> :vs input.txt <bar> :wincmd h <bar> :vertical resize 130 <LF>
nnoremap <buffer> <F9> <ScriptCmd>Run_CPP() <LF>
nnoremap <buffer> <C-t> <ScriptCmd>Past_Tests()<LF>
#nnoremap <buffer> <C-w> :%y+<LF>