branch: simplify async logic a bit
This commit is contained in:
parent
ead2cd63bb
commit
941341d085
@ -123,6 +123,16 @@ if v:version >= 800 && has("job")
|
|||||||
let s:po_jobs[a:file] = id
|
let s:po_jobs[a:file] = id
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! airline#async#vcs_untracked(config, file, vcs)
|
||||||
|
if g:airline#init#vim_async
|
||||||
|
" Vim 8 with async support
|
||||||
|
noa call airline#async#vim_vcs_untracked(a:config, a:file)
|
||||||
|
else
|
||||||
|
" nvim async or vim without job-feature
|
||||||
|
noa call airline#async#nvim_vcs_untracked(a:config, a:file, a:vcs)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! airline#async#vim_vcs_untracked(config, file)
|
function! airline#async#vim_vcs_untracked(config, file)
|
||||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||||
let cmd = a:config['cmd'] . shellescape(a:file)
|
let cmd = a:config['cmd'] . shellescape(a:file)
|
||||||
|
@ -194,17 +194,12 @@ function! s:update_untracked()
|
|||||||
|
|
||||||
for vcs in keys(s:vcs_config)
|
for vcs in keys(s:vcs_config)
|
||||||
let config = s:vcs_config[vcs]
|
let config = s:vcs_config[vcs]
|
||||||
if g:airline#init#vim_async
|
" Note that asynchronous update updates s:vcs_config only, and only
|
||||||
" Note that asynchronous update updates s:vcs_config only, and only
|
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
|
||||||
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
|
" invalidated again before s:update_untracked is called, then we lose the
|
||||||
" invalidated again before s:update_untracked is called, then we lose the
|
" result of the previous call, i.e. the head string is not updated. It
|
||||||
" result of the previous call, i.e. the head string is not updated. It
|
" doesn't happen often in practice, so we let it be.
|
||||||
" doesn't happen often in practice, so we let it be.
|
call airline#async#vcs_untracked(config, file, vcs)
|
||||||
noa call airline#async#vim_vcs_untracked(config, file)
|
|
||||||
else
|
|
||||||
" nvim async or vim without job-feature
|
|
||||||
noa call airline#async#nvim_vcs_untracked(config, file, vcs)
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user