-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-log.vim
49 lines (39 loc) · 1.11 KB
/
dev-log.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
let s:logs = []
function! DeeLogInfo()
return '🍔' . len(s:logs)
endfunction
let s:preview = tempname()
let s:scratch = tempname()
call writefile( [ "[...document.querySelectorAll('div')].map( e => e.innerText)" ], s:scratch, 'b')
let s:scratchResult = tempname()
function! DeeUpdateStatusLine()
setlocal statusline=
setlocal statusline+=%f
setlocal statusline+=\ %{DeeLogInfo()}
endfunction
function! DeeOnLogEntry(obj)
endfunction
function! DeeOnLogCall(obj)
endfunction
function! DeeOnFrameResult(obj)
endfunction
function! DeeOnEvalResult(obj)
echom "result..."
let file = s:scratchResult
call writefile( split(a:obj.description,"\n"), file, 'b')
exe ":pedit " . file
endfunction
function! DeeVeeEdit()
exe ":e ".s:scratch
exe ":au! * <buffer>"
exe ":au InsertLeave <buffer> call DeeVee()"
exe ":au BufWritePost <buffer> call DeeVee()"
exe ":pedit " . s:scratchResult
endfunction
function! DeeVee()
let buff=join(getline(1, '$'), "\n")
let obj = { 'expression': buff }
call DeeAction('eval', obj)
endfunction
noremap § :pclose<cr>
noremap ¡ :call DeeVeeEdit()<cr>