First of all, you most likely need to use chansend()
function. I don't have term_sendkeys()
in my neovim
instance, so it's probably from some plugin. Also, the i
is unnecessary, since this function can't put you into insert mode.
Now, regarding your problem. "\<Up>"
does indeed have some unexpected behavior inside double quotes. But, I managed to work around it like this:
- Open
vim
preemptively to not get error on load. - While in terminal, start by writing
echo -n '' >> ~/.vimrc
, then put cursor between quotes and presscontrol-v
followed byUp
, thenenter
to execute your command. - Reload
.vimrc
with:e!
, delete the last line with literalUp
sequence, andp
it wherever you want (in this case, intochansend
function).
This seem to work correctly:
call chansend(b:terminal_job_id, '^[OA' . "\<cr>")
Do not try to copy code from here, though. You need to get actual literal Up
sequence from your shell.