aboutsummaryrefslogtreecommitdiff
path: root/examples/llm.vim
diff options
context:
space:
mode:
authorchaihahaha <chai836275709@gmail.com>2023-08-08 20:07:02 +0800
committerGitHub <noreply@github.com>2023-08-08 15:07:02 +0300
commit7ed8d1fe7f8cbe6a6763e6b46759795ac8d21e12 (patch)
tree1cf5a0d4931aae37fe40f01539b45c1f3a663b06 /examples/llm.vim
parente7f94d6fdc83b41ba449b4b8c80821673dd12ffc (diff)
llm.vim : multiline autocompletion, get rid of "^@" (#2543)
Diffstat (limited to 'examples/llm.vim')
-rw-r--r--examples/llm.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/llm.vim b/examples/llm.vim
index 473e007..594a285 100644
--- a/examples/llm.vim
+++ b/examples/llm.vim
@@ -18,8 +18,10 @@ function! Llm()
" Extract the content field from the response
let content = json_decode(response).content
+ let split_newlines = split(content, '\n', 1)
+
" Insert the content at the cursor position
- call setline(line('.'), getline('.') . content)
+ call setline(line('.'), [ getline('.') . split_newlines[0] ] + split_newlines[1:])
endfunction
command! Llm call Llm()