summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMartin Bielik <mx.bielik@gmail.com>2023-03-12 19:47:21 +0100
committerMartin Bielik <mx.bielik@gmail.com>2023-03-12 19:47:21 +0100
commit0faae7b1fbec281f5a645f25e5012d9deb307f56 (patch)
tree94a58dd42133894af446335175a482698f9c7c44 /plugin
parent59a89739b3d25fc74891b6e086c40b6830702103 (diff)
downloadvim-ai-0faae7b1fbec281f5a645f25e5012d9deb307f56.tar.gz
getting rid of global dependencies
Diffstat (limited to '')
-rw-r--r--plugin/vim-ai.vim16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugin/vim-ai.vim b/plugin/vim-ai.vim
index 6c473b1..a5ded7a 100644
--- a/plugin/vim-ai.vim
+++ b/plugin/vim-ai.vim
@@ -33,9 +33,11 @@ function! AIRun(...) range
if g:vim_ai_debug
echo "Prompt:\n" . prompt . "\n"
endif
-
echo "Completing..."
- let output = system("echo " . shellescape(prompt) . " | python3 " . s:complete_py . " ")
+ " WORKAROUND: without sleep is echo on prev line not displayed (when combining with py3)
+ execute 'silent sleep 1m'
+ execute "py3file " . s:complete_py
+ let output = py3eval('output')
let output = trim(output)
execute "normal! " . a:lastline . "G"
@@ -59,7 +61,10 @@ function! AIEditRun(...) range
endif
echo "Editing..."
- let output = system("echo " . shellescape(prompt) . " | python3 " . s:complete_py . " ")
+ " WORKAROUND: without sleep is echo on prev line not displayed (when combining with py3)
+ execute 'silent sleep 1m'
+ execute "py3file " . s:complete_py
+ let output = py3eval('output')
let output = trim(output)
execute a:firstline . ',' . a:lastline . 'd'
@@ -107,7 +112,10 @@ function! AIChatRun(...) range
endif
echo "Answering..."
- let output = system("echo " . shellescape(prompt) . " | python3 " . s:chat_py . " ")
+ " WORKAROUND: without sleep is echo on prev line not displayed (when combining with py3)
+ execute 'silent sleep 1m'
+ execute "py3file " . s:chat_py
+ let output = py3eval('output')
set paste
execute "normal! ggdG"