Questions tagged [job-control]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
37 views

How do you send vim to the background from a terminal window?

I just learned that Vim has the :terminal command, which opens a window with a terminal session inside. Previously, my normal workflow was to launch vim from my terminal and use job control to get in ...
user avatar
  • 149
0 votes
1 answer
21 views

Help in troubleshooting strange behavior when resuming Vim from background

Latest update I start to think that the problem is not due to Vim in the first place. See this. Previous update I think I've almost tracked it down. The issue seems to be due to either command-t or ...
user avatar
  • 1,668
0 votes
0 answers
40 views

How to set up a buffer to receive command output

In my $VIMRC, I would like to autocmd BufWinEnter *.ly call s:BufWinEnterLY() autocmd TextChanged *.ly call s:TextChangedLY() autocmd BufUnload *.ly call s:BufUnloadLY() I want s:BufWinEnterLY() to ...
user avatar
  • 1
2 votes
1 answer
49 views

Why does ch_evalraw() evaluate to my message instead of the response?

I am trying to learn about jobs and channels on Vim (on Windows), and I am using the following sequence as an example: let job = job_start("cmd") let channel = job_getchannel(job) let ...
user avatar
1 vote
1 answer
49 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', '...
user avatar
1 vote
1 answer
120 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 ...
user avatar
3 votes
0 answers
104 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, { \ '...
user avatar
  • 1,043
2 votes
1 answer
405 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 ...
user avatar
  • 883
1 vote
1 answer
434 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 " ...
user avatar
  • 883
4 votes
2 answers
2k 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 ...
user avatar
  • 883
0 votes
1 answer
79 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': '...
user avatar
  • 45
0 votes
0 answers
163 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 ...
user avatar
  • 225
7 votes
1 answer
704 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 ...
user avatar
  • 2,550
2 votes
1 answer
422 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 ...
user avatar
6 votes
1 answer
710 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/...
user avatar
  • 447
3 votes
1 answer
193 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 ...
user avatar
1 vote
0 answers
273 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:...
user avatar
  • 5,908
1 vote
0 answers
66 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 ...
user avatar
  • 1,517
1 vote
1 answer
118 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 ...
user avatar
3 votes
1 answer
1k 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 ...
user avatar
3 votes
1 answer
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 ...
user avatar
3 votes
0 answers
119 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 ...
user avatar
  • 1,071
1 vote
1 answer
248 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 ...
user avatar
1 vote
2 answers
533 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 ...
user avatar
  • 357