Quellcode durchsuchen

llm.vim : multiline autocompletion, get rid of "^@" (#2543)

chaihahaha vor 2 Jahren
Ursprung
Commit
7ed8d1fe7f
1 geänderte Dateien mit 3 neuen und 1 gelöschten Zeilen
  1. 3 1
      examples/llm.vim

+ 3 - 1
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()