init async global variables
This commit is contained in:
parent
57ca6c9e78
commit
f706edee9f
@ -6,7 +6,7 @@ scriptencoding utf-8
|
|||||||
let s:has_fugitive = exists('*fugitive#head')
|
let s:has_fugitive = exists('*fugitive#head')
|
||||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||||
let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')
|
let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')
|
||||||
let s:has_async = v:version >= 800 && has('job')
|
let s:has_async = airline#util#async
|
||||||
let s:git_cmd = 'git status --porcelain -- '
|
let s:git_cmd = 'git status --porcelain -- '
|
||||||
let s:hg_cmd = 'hg status -u -- '
|
let s:hg_cmd = 'hg status -u -- '
|
||||||
|
|
||||||
@ -121,13 +121,15 @@ if s:has_async
|
|||||||
let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||||
if empty(self.buf)
|
if empty(self.buf)
|
||||||
let s:untracked_{self.cmd}[self.file] = ''
|
let s:untracked_{self.cmd}[self.file] = ''
|
||||||
else
|
elseif (self.buf[0:1] is# '??' && self.cmd is# 'git') || (self.buf[0] is# '?' && self.cmd is# 'hg')
|
||||||
let s:untracked_{self.cmd}[self.file] = untracked
|
let s:untracked_{self.cmd}[self.file] = untracked
|
||||||
|
else
|
||||||
|
let s:untracked_{self.cmd}[self.file] = ''
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:DoAsync(cmd, file)
|
function! s:DoAsync(cmd, file)
|
||||||
if (has('win32') || has('win64')) && &shell =~ 'cmd'
|
if g:airline#util#is_windows && &shell =~ 'cmd'
|
||||||
let cmd = a:cmd. shellescape(a:file)
|
let cmd = a:cmd. shellescape(a:file)
|
||||||
else
|
else
|
||||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||||
@ -276,5 +278,4 @@ function! airline#extensions#branch#init(ext)
|
|||||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head
|
autocmd User AirlineBeforeRefresh unlet! b:airline_head
|
||||||
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
||||||
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -32,6 +32,9 @@ function! airline#init#bootstrap()
|
|||||||
call s:check_defined('g:airline_exclude_preview', 0)
|
call s:check_defined('g:airline_exclude_preview', 0)
|
||||||
call s:check_defined('g:airline_gui_mode', airline#init#gui_mode())
|
call s:check_defined('g:airline_gui_mode', airline#init#gui_mode())
|
||||||
|
|
||||||
|
let g:airline#util#async = v:version >= 800 && has('job')
|
||||||
|
let g:airline#util#is_windows = has('win32') || has('win64')
|
||||||
|
|
||||||
call s:check_defined('g:airline_mode_map', {})
|
call s:check_defined('g:airline_mode_map', {})
|
||||||
call extend(g:airline_mode_map, {
|
call extend(g:airline_mode_map, {
|
||||||
\ '__' : '------',
|
\ '__' : '------',
|
||||||
@ -147,4 +150,3 @@ function! airline#init#sections()
|
|||||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'neomake_warning_count', 'whitespace'])
|
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'neomake_warning_count', 'whitespace'])
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -77,4 +77,3 @@ else
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user