Remove getbufoneline usage, Add input bind example.
getbufoneline() appears to be a recently added function and has been replaced with getbufline for compatibility. An additional example that explains how to add a keybind that works in insert mode was added.
This commit is contained in:
parent
f8f0d59765
commit
00e9a228dc
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,8 @@
|
||||||
" Then start with either :call llama#doLlamaGen(),
|
" Then start with either :call llama#doLlamaGen(),
|
||||||
" or add a keybind to your vimrc such as
|
" or add a keybind to your vimrc such as
|
||||||
" nnoremap Z :call llama#doLlamaGen()<CR>
|
" nnoremap Z :call llama#doLlamaGen()<CR>
|
||||||
|
" Similarly, you could add an insert mode keybind with
|
||||||
|
" inoremap <C-B> <Cmd>call llama#doLlamaGen()<CR>
|
||||||
"
|
"
|
||||||
" g:llama_api_url and g:llama_overrides can be configured in your .vimrc
|
" g:llama_api_url and g:llama_overrides can be configured in your .vimrc
|
||||||
" let g:llama_api_url = "192.168.1.10:8080"
|
" let g:llama_api_url = "192.168.1.10:8080"
|
||||||
|
@ -41,7 +43,7 @@ func s:callbackHandler(bufn, channel, msg)
|
||||||
let l:decoded_msg = json_decode(l:msg)
|
let l:decoded_msg = json_decode(l:msg)
|
||||||
let l:newtext = split(l:decoded_msg['content'], "\n", 1)
|
let l:newtext = split(l:decoded_msg['content'], "\n", 1)
|
||||||
if len(l:newtext) > 0
|
if len(l:newtext) > 0
|
||||||
call setbufline(a:bufn, s:linedict[a:bufn], getbufoneline(a:bufn, s:linedict[a:bufn]) .. newtext[0])
|
call setbufline(a:bufn, s:linedict[a:bufn], getbufline(a:bufn, s:linedict[a:bufn])[0] .. newtext[0])
|
||||||
else
|
else
|
||||||
echo "nothing genned"
|
echo "nothing genned"
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue