1

So I am trying to send some json text to a python script with jobsend in neovim like this:

let l:json_msg = json_encode(a:msg)
call jobsend(s:vimwatcher_job, l:json_msg)

If i echo l:json_msg I can see that the l:json_msg is a properly encoded string yet my program receives nothing from stdin at all.

If I run echo jobsend(s:vimwatcher_job, l:json_msg) I can see that the return code is 1 so it seems to succeed.

It works fine however in normal vim like this (without the encoding and setting the in_mode on job_start to "json")

call ch_sendexpr(s:vimwatcher_job, a:msg)

Any idea what could go wrong?

1 Answer 1

0

I was missing newlines, I assumed that jobsend appended newlines to each message since ch_sendexpr did but that was not the case.

Reading the documentation and stubling upon an example made me find the solution. When using ch_sendraw in normal vim I would also need newlines, so it all makes sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.