1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 09:40:06 +08:00
SpaceVim/bundle/vim-dispatch/autoload/dispatch/headless.vim

31 lines
774 B
VimL
Vendored

" dispatch.vim headless strategy
if exists('g:autoloaded_dispatch_headless')
finish
endif
let g:autoloaded_dispatch_headless = 1
function! dispatch#headless#handle(request) abort
if !a:request.background || &shell !~# 'sh'
return 0
endif
if a:request.action ==# 'make'
let command = dispatch#prepare_make(a:request)
elseif a:request.action ==# 'start'
let command = dispatch#prepare_start(a:request)
else
return 0
endif
if &shellredir =~# '%s'
let redir = printf(&shellredir, '/dev/null')
else
let redir = &shellredir . ' ' . '/dev/null'
endif
call system(&shell.' '.&shellcmdflag.' '.shellescape(command).redir.' &')
return !v:shell_error
endfunction
function! dispatch#headless#activate(pid) abort
return 0
endfunction