summaryrefslogtreecommitdiff
path: root/vim/vim-potion/autoload/potion/running.vim
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-05-29 20:27:28 +0200
committerMiguel <m.i@gmx.at>2018-05-29 20:27:28 +0200
commit68b54b0d1729cd036fcba1c85f85ad4af6e9e3dc (patch)
tree3d0f4e5eb1b147ae9ba193065d9c7b09f8e72f16 /vim/vim-potion/autoload/potion/running.vim
added vim stuff
Diffstat (limited to 'vim/vim-potion/autoload/potion/running.vim')
-rw-r--r--vim/vim-potion/autoload/potion/running.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/vim/vim-potion/autoload/potion/running.vim b/vim/vim-potion/autoload/potion/running.vim
new file mode 100644
index 0000000..562f713
--- /dev/null
+++ b/vim/vim-potion/autoload/potion/running.vim
@@ -0,0 +1,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