blob: 562f7136b7ff23d676db32df334310075e023868 (
plain)
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
|
function! potion#running#PotionCompileAndRunFile()
write
silent !clear
execute "!" . g:potion_command . " " . bufname("%")
endfunction
function! potion#running#PotionShowBytecode()
write
" Get the bytecode.
let bytecode = system(g:potion_command . " -c -V " . bufname("%") . " 2>&1")
" Check returned string for errors.
if bytecode=~#"Syntax error"
let bytecode = "SYNTAX ERROR!! Check your potion."
endif
" Open a new split and set it up or use existing one!
let potbufnr=bufwinnr('__Potion_Bytecode__')
if potbufnr==#-1
vsplit __Potion_Bytecode__
else
execute potbufnr.'wincmd w'
endif
normal! ggdG
setlocal filetype=potionbytecode
setlocal buftype=nofile
" Insert the bytecode.
call append(0, split(bytecode, '\v\n'))
endfunction
|