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:
parent
cc8f47e248
commit
a26a460698
@ -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.
|
||||
if index(vcs_checks, 'untracked') > -1
|
||||
call airline#async#vcs_untracked(config, file, vcs)
|
||||
endif
|
||||
" Check clean state of repo
|
||||
if index(vcs_checks, 'dirty') > -1
|
||||
call airline#async#vcs_clean(config.dirty, file, vcs)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
@ -514,6 +514,16 @@ characters.
|
||||
endif
|
||||
return b:perforce_client
|
||||
endfunction
|
||||
>
|
||||
* configure additional vcs checks to run
|
||||
By default, vim-airline will check if the current edited file is untracked
|
||||
in the repository. If so, it will append the `g:airline_symbols.notexists`
|
||||
symbol to the branch name.
|
||||
In addition, it will check if the repository is clean, else it will append
|
||||
the `g:airline_symbols.dirty` symbol to the branch name (if the current file
|
||||
is not untracked). Configure, by setting the following variable: >
|
||||
|
||||
let g:airline#extensions#branch#vcs_checks = ['untracked', 'dirty']
|
||||
<
|
||||
------------------------------------- *airline-bufferline*
|
||||
vim-bufferline <https://github.com/bling/vim-bufferline>
|
||||
|
Loading…
Reference in New Issue
Block a user