I have a shell command which reads from stdin, processes the input, and writes to stdout. To call it synchronously from vim I can do system('mycommand', data) where data is some string my vimscript has prepared.

What's the equivalent way to pass data to stdin using job_start() / jobstart()?

Update: in this case I'm particularly interested in the answer for neovim.

1 Answer 1



let job = job_start(...)
let channel = job_getchannel(job)
call ch_sendraw(channel, data)
call ch_close_in(channel)


let jobid = jobstart(...)
call chansend(jobid, data)
call chanclose(jobid, 'stdin')

Your Answer

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

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