branch: don't check untracked status for files in vcs dir

Currently, vim-airline will check untracked status for files e.g. living
in .git. So when editing .git/config it will show as being untracked.

While technically, this is correct I prefer not to see this for those
files. So skip the check for those files.
This commit is contained in:
Christian Brabandt 2017-06-24 14:03:40 +02:00
parent ac032b752a
commit 0a352c9f5b
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,7 @@ let s:vcs_config = {
\ 'cmd': 'git status --porcelain -- ', \ 'cmd': 'git status --porcelain -- ',
\ 'untracked_mark': '??', \ 'untracked_mark': '??',
\ 'update_branch': 's:update_git_branch', \ 'update_branch': 's:update_git_branch',
\ 'exclude': '\.git',
\ 'branch': '', \ 'branch': '',
\ 'untracked': {}, \ 'untracked': {},
\ }, \ },
@ -36,6 +37,7 @@ let s:vcs_config = {
\ 'exe': 'hg', \ 'exe': 'hg',
\ 'cmd': 'hg status -u -- ', \ 'cmd': 'hg status -u -- ',
\ 'untracked_mark': '?', \ 'untracked_mark': '?',
\ 'exclude': '\.hg',
\ 'update_branch': 's:update_hg_branch', \ 'update_branch': 's:update_hg_branch',
\ 'branch': '', \ 'branch': '',
\ 'untracked': {}, \ 'untracked': {},
@ -165,6 +167,10 @@ function! s:update_untracked()
let l:needs_update = 1 let l:needs_update = 1
for vcs in keys(s:vcs_config) for vcs in keys(s:vcs_config)
if l:file =~ s:vcs_config[vcs].exclude
" Skip check for files that live in the exclude directory
let l:needs_update = 0
endif
if has_key(s:vcs_config[vcs].untracked, l:file) if has_key(s:vcs_config[vcs].untracked, l:file)
let l:needs_update = 0 let l:needs_update = 0
call s:update_untracked_in_buffer_config(l:file, vcs) call s:update_untracked_in_buffer_config(l:file, vcs)