async: Better check for nvim

closes neovim/neovim#7186
This commit is contained in:
Christian Brabandt 2017-08-21 21:23:34 +02:00
parent 470e9870f1
commit c2b2351d99
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 7 additions and 11 deletions

View File

@ -11,8 +11,6 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
finish
endif
let s:has_async = airline#util#async
" s:vcs_config contains static configuration of VCSes and their status relative
" to the active file.
" 'branch' - The name of currently active branch. This field is empty iff it
@ -123,7 +121,7 @@ endfunction
function! s:update_hg_branch(path)
if s:has_lawrencium
let stl=lawrencium#statusline()
if !empty(stl) && s:has_async
if !empty(stl) && g:airline#init#async
call s:get_mq_async('LC_ALL=C hg qtop', expand('%:p'))
endif
if exists("s:mq") && !empty(s:mq)
@ -183,7 +181,7 @@ function! s:update_untracked()
for vcs in keys(s:vcs_config)
let l:config = s:vcs_config[vcs]
if s:has_async
if g:airline#init#async
" Note that asynchronous update updates s:vcs_config only, and only
" 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
@ -202,7 +200,7 @@ function! s:update_untracked()
endfor
endfunction
if s:has_async
if g:airline#init#async
let s:jobs = {}
function! s:on_stdout(channel, msg) dict abort
@ -377,7 +375,7 @@ endfunction
function! s:reset_untracked_cache(shellcmdpost)
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
if !s:has_async && !has('nvim')
if !g:airline#init#async && !has('nvim')
if a:shellcmdpost
" Clear cache only if there was no error or the script uses an
" asynchronous interface. Otherwise, cache clearing would overwrite

View File

@ -3,8 +3,6 @@
scriptencoding utf-8
let s:has_async = airline#util#async
function! s:shorten()
if exists("g:airline#extensions#po#displayed_limit")
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
@ -14,7 +12,7 @@ function! s:shorten()
endif
endfunction
if s:has_async
if airline#init#async
let s:jobs = {}
function! s:on_stdout(channel, msg) dict abort
@ -70,7 +68,7 @@ function! airline#extensions#po#stats()
endif
let cmd = 'msgfmt --statistics -o /dev/null -- '
if s:has_async
if airline#init#async
call s:get_msgfmt_stat_async(cmd, expand('%:p'))
else
let airline_po_stats = system(cmd. shellescape(expand('%:p')))

View File

@ -18,7 +18,7 @@ function! airline#init#bootstrap()
let g:airline#init#bootstrapping = 1
let g:airline#util#async = v:version >= 800 && has('job')
let g:airline#init#async = (has("nvim") || (v:version >= 800 && has('job')))
let g:airline#util#is_windows = has('win32') || has('win64')
call s:check_defined('g:airline_detect_modified', 1)