3

I wanted to try vim 8.0's new job start feature with a simple "hello world" style example. I tried:

:let job = job_start('ls -alh')

but there is no output. I tried

echo job_info(job)

and that output:

{'status': 'dead', 'stoponexit': 'term', 'exitval': 0, 'exit_cb': 0, 'channel': channel 2 closed, 'process': 32415}

not not the output of the job. how can I get this?

4

Vim jobs start with a channel, you can use job-options to redirect output to a buffer. For example:

:let job = job_start('ls -alh', {'out_io': 'buffer', 'out_name': 'mybuffer'})

then

:sbuf mybuffer

to read it.

Ref: :h job-start.

Escaping issues (dependent on the platform) can be fixed with a list (issue 1539):

let args = ['/bin/bash', '-c', cmd]
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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