mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-02-23 01:58:26 +08:00
branch: configure what additional checks to run
Allow to customize, whether to check the untracked status of a file or whether the current repository is clean. fixes #1910
This commit is contained in:
@@ -180,6 +180,7 @@ function! s:update_untracked()
|
||||
endif
|
||||
|
||||
let needs_update = 1
|
||||
let vcs_checks = get(g:, "airline#extensions#branch#vcs_checks", ["untracked", "dirty"])
|
||||
for vcs in keys(s:vcs_config)
|
||||
if file =~ s:vcs_config[vcs].exclude
|
||||
" Skip check for files that live in the exclude directory
|
||||
@@ -202,9 +203,13 @@ function! s:update_untracked()
|
||||
" 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
|
||||
" doesn't happen often in practice, so we let it be.
|
||||
call airline#async#vcs_untracked(config, file, vcs)
|
||||
if index(vcs_checks, 'untracked') > -1
|
||||
call airline#async#vcs_untracked(config, file, vcs)
|
||||
endif
|
||||
" Check clean state of repo
|
||||
call airline#async#vcs_clean(config.dirty, file, vcs)
|
||||
if index(vcs_checks, 'dirty') > -1
|
||||
call airline#async#vcs_clean(config.dirty, file, vcs)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user