Questions tagged [job-control]
The job-control tag has no usage guidance.
21
questions
1
vote
1answer
14 views
keep contents of nofile buffer
My plugin creates new buffer, sets buffer type to nofile and fills it with text via job_start with out_io=buffer. Simplified code:
enew
setl bt=nofile
...
call job_start(cmd, {'out_io': 'buffer', '...
1
vote
1answer
68 views
How to use JSON API to send messages from terminal to vim?
In terminal.txt, there is description about terminal-api, but it seems not to give a example to show how the message is send from terminal to vim function Tapi_..., is there some examples for the ...
3
votes
0answers
64 views
Why would job_start()'s close_cb sometimes not be called?
I have a job_start() call like this:
let options = {
\ 'stdoutbuffer': [],
\ 'handler': a:handler,
\ }
let command = s:build_command(a:cmd)
let s:job = job_start(command, {
\ '...
0
votes
0answers
19 views
running job disconnects from buffer
I'm trying to implement tail -f buffer via job_start. It works well unless I switch to other buffer (:bn). When I return to tail-buffer, it's empty.
let job = job_start(['tail', '-f', 'some_log_file'],...
2
votes
1answer
102 views
What is the proper way to use the async mechanism: timer_start
I just started to use Vim 8 and I'm trying to figure out how to use the async mechanism: timer_start.
As my understanding, timer_start allows us to run a job asynchronously and repeatly.
I have two ...
1
vote
1answer
109 views
Vim Script: How to pass Varargs to a lambda in timer_start
I'm configuring my vim with Vim Script.
I have set my own custom grep function as below:
function! CustomGrepCore(...)
if a:0 == 0
" do something
else if a:0 == 1
" ...
2
votes
2answers
587 views
How to start an async function in Vim 8
I've known that Vim 8 provides us an async mechanism job_start so that we can start a command asynchronously and get its return with the help of channel.
However, it seems that job_start can only ...
0
votes
1answer
38 views
How to pass a parameter to a function called from an on_exit event of an asynchronous task
Imagine the following asynchronous job to convert a given file to odt :
let mdfile = 'testfile.md'
call jobstart (['bash', '-c', 'pandoc ' . mdfile . ' -s -f markdown -o test.odt'], {'on_exit': '...
0
votes
0answers
59 views
Make vim commands be executed once a job on a terminal buffer has finished
The context
I've the following mapping in ~/.vim/ftplugin/cpp/mappings.vim. What this mapping does is to compile an arbitrary C++ file and open two windows (a) and (b). (a) shows the output of the ...
4
votes
1answer
198 views
prevent line wrap in terminal buffer
I can easily see the output of a command in a split using vim's terminal
For example, I use :vertical terminal make re a lot.
This example is also stated in the help (h :terminal):
Or to run build ...
1
vote
1answer
110 views
Neovim Jobstart(), not receiving STDOUT sometimes (if async I think)
Working Base Test
Working on a plugin, and it wasnt working on windows, so I reduced it to this test scenario:
function! myautoload#OnStdout(job_id, data, event)
for line in a:data
echom ...
5
votes
1answer
349 views
job_start() command only works with seemingly random job options
I am getting some unexpected behavior when trying to run the zip shell command using Vim's job_start().
As an example, suppose I have two images (im1.png and im2.jpg) in the directory /home/username/...
2
votes
1answer
123 views
Job continuously outputting to Vim buffer
I have a job that produces output continually. I want to write this output to a Vim buffer. I start it with:
let job = job_start(cmd, { 'out_io': 'buffer', 'out_name': 'joboutput' })
But I can't see ...
1
vote
0answers
199 views
How to flush job output in vim8?
Trying to do something with job output in exit_cb or close_cb, but it's all buffered, how to flush it. e.g.:
function! s:exit_cb(job, status)
echom getbufline(s:bufnr, '$')
endfunction
function! s:...
1
vote
0answers
47 views
neovim: exit code for jobs terminated by jobstop
When I call jobstop on a running script waiting for input, the on_exit callback is invoked. But the exit code is always 0.
Is this the correct behavior?
According to :h jobstop it should be killed ...
1
vote
1answer
92 views
jobsend sends no data even though return code is 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 ...
3
votes
1answer
819 views
Vim immediately sent to background
Whenever I call Vim from the CLI, either to edit a file (vim idk.tex) or without arguments, or run a command (vim +help), it gets sent to the background, as if I had pressed Ctrl+Z.
In order to use ...
3
votes
1answer
2k views
How do I get the output of a vim 8.0 job?
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 ...
3
votes
0answers
115 views
How to emulate vim job out_io buffer with neovim?
I'd like to make a plugin with functionality that is similar to https://github.com/ramele/agrep and grep-edit in emacs. That is get search results from ag or some other tool that supports multiline ...
1
vote
1answer
213 views
How can I set the working directory for only the job_start() process?
I would like to set the working directory for the process started with job_start().
The only way I know how to do this is to change Vim's current working directory before calling job_start(), and ...
1
vote
2answers
507 views
Run :cwindow after :Neomake finishes
How do I attach a callback to :NeomakeProject so that :cwindow is executed after compilation finishes?
i.e. I'm too lazy and want everything (open the error list) to happen automatically. (currently ...