]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llm.vim : multiline autocompletion, get rid of "^@" (#2543)
authorchaihahaha <redacted>
Tue, 8 Aug 2023 12:07:02 +0000 (20:07 +0800)
committerGitHub <redacted>
Tue, 8 Aug 2023 12:07:02 +0000 (15:07 +0300)
examples/llm.vim

index 473e0077ad4e910abc245567710cda508fc37d8a..594a285493dccb3f127f1e55fed230173d6f9a03 100644 (file)
@@ -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()