comparison autoload/gutentags.vim @ 211:011d855724bf

Make Vim8 terminate the background job on exit.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 12 Jun 2018 21:11:53 -0700
parents 7371d8750c46
children 60229a0ea17d
comparison
equal deleted inserted replaced
210:39547ffc8867 211:011d855724bf
561 function! s:nvim_job_out_wrapper(real_cb, job, lines, event_type) abort 561 function! s:nvim_job_out_wrapper(real_cb, job, lines, event_type) abort
562 call call(a:real_cb, [a:job, a:lines]) 562 call call(a:real_cb, [a:job, a:lines])
563 endfunction 563 endfunction
564 564
565 function! gutentags#build_default_job_options(module) abort 565 function! gutentags#build_default_job_options(module) abort
566 let l:job_opts = { 566 " Neovim kills jobs on exit, which is what we want.
567 \'on_exit': function( 567 let l:job_opts = {
568 \ '<SID>nvim_job_exit_wrapper', 568 \'on_exit': function(
569 \ ['gutentags#'.a:module.'#on_job_exit']), 569 \ '<SID>nvim_job_exit_wrapper',
570 \'on_stdout': function( 570 \ ['gutentags#'.a:module.'#on_job_exit']),
571 \ '<SID>nvim_job_out_wrapper', 571 \'on_stdout': function(
572 \ ['gutentags#default_io_cb']), 572 \ '<SID>nvim_job_out_wrapper',
573 \'on_stderr': function( 573 \ ['gutentags#default_io_cb']),
574 \ '<SID>nvim_job_out_wrapper', 574 \'on_stderr': function(
575 \ ['gutentags#default_io_cb']) 575 \ '<SID>nvim_job_out_wrapper',
576 \} 576 \ ['gutentags#default_io_cb'])
577 return l:job_opts 577 \}
578 return l:job_opts
578 endfunction 579 endfunction
579 580
580 function! gutentags#start_job(cmd, opts) abort 581 function! gutentags#start_job(cmd, opts) abort
581 return jobstart(a:cmd, a:opts) 582 return jobstart(a:cmd, a:opts)
582 endfunction 583 endfunction
583 else 584 else
584 " Vim8 job API. 585 " Vim8 job API.
585 function! gutentags#build_default_job_options(module) abort 586 function! gutentags#build_default_job_options(module) abort
586 let l:job_opts = { 587 let l:job_opts = {
587 \'exit_cb': 'gutentags#'.a:module.'#on_job_exit', 588 \'exit_cb': 'gutentags#'.a:module.'#on_job_exit',
588 \'out_cb': 'gutentags#default_io_cb', 589 \'out_cb': 'gutentags#default_io_cb',
589 \'err_cb': 'gutentags#default_io_cb' 590 \'err_cb': 'gutentags#default_io_cb',
590 \} 591 \'stoponexit': 'term'
592 \}
591 return l:job_opts 593 return l:job_opts
592 endfunction 594 endfunction
593 595
594 function! gutentags#start_job(cmd, opts) abort 596 function! gutentags#start_job(cmd, opts) abort
595 return job_start(a:cmd, a:opts) 597 return job_start(a:cmd, a:opts)