summaryrefslogtreecommitdiff
path: root/plugin/vim-ai.vim
diff options
context:
space:
mode:
authorMartin Bielik <mx.bielik@gmail.com>2023-04-02 23:18:36 +0200
committerMartin Bielik <mx.bielik@gmail.com>2023-04-02 23:18:36 +0200
commitb209554bf26d4662d126aa664875fd91dc803f62 (patch)
tree83907f12f0c7e821fc544180c238dd61e84522b3 /plugin/vim-ai.vim
parent3b04fa1b764129395f54ab1b1297a4ce45e4105e (diff)
downloadvim-ai-b209554bf26d4662d126aa664875fd91dc803f62.tar.gz
restore chat support
Diffstat (limited to '')
-rw-r--r--plugin/vim-ai.vim10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugin/vim-ai.vim b/plugin/vim-ai.vim
index 9232d47..6192f1d 100644
--- a/plugin/vim-ai.vim
+++ b/plugin/vim-ai.vim
@@ -109,13 +109,21 @@ function! AIChatRun(is_selection, ...) range
set paste
let is_outside_of_chat_window = search('^>>> user$', 'nw') == 0
if is_outside_of_chat_window
+ " open chat window
execute g:vim_ai_chat['ui']['open_chat_command']
let prompt = ""
if a:0 || a:is_selection
let instruction = a:0 ? a:1 : ""
let prompt = MakePrompt(a:is_selection, lines, instruction)
endif
- execute "normal! i>>> user\n\n" . prompt
+ let is_outside_of_chat_window = search('^>>> user$', 'nw') == 0
+ if is_outside_of_chat_window
+ " write an user prompt
+ execute "normal! i>>> user\n\n" . prompt
+ else
+ " appending prompt into restored conversation
+ execute "normal! Gi" . prompt
+ endif
endif
let s:last_command = "chat"