Questions tagged [job-control]
The job-control tag has no usage guidance.
25
questions
1
vote
0
answers
27
views
How to distinguish between two different terminal exit statuses?
Consider the following example:
term_start(myprogram, {exit_cb: MyExitHandler})
def MyExitHandler()
if exit_status != 0
echom "Error!"
endif
enddef
The function MyExitHandler is ...
2
votes
1
answer
2k
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 ...
0
votes
1
answer
44
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 ...
0
votes
0
answers
249
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 ...
2
votes
1
answer
55
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 ...
1
vote
1
answer
99
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
1
answer
177
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 ...
4
votes
0
answers
141
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, {
\ '...
2
votes
1
answer
1k
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 ...
2
votes
1
answer
642
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
" ...
7
votes
2
answers
4k
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
1
answer
226
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
0
answers
304
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 ...
7
votes
1
answer
1k
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 ...
2
votes
1
answer
1k
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 ...