fugitive: mark fugitive like buffers with "[git]"

closes #1852
This commit is contained in:
Christian Brabandt 2019-02-02 18:04:53 +01:00
parent dc7d991007
commit 54584a2bb2
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 7 additions and 3 deletions

View File

@ -8,7 +8,8 @@ if !airline#util#has_fugitive()
endif endif
if exists("+autochdir") && &autochdir == 1 let s:has_autochdir = exists("+autochdir") && &autochdir
if s:has_autochdir
let s:fmod = ':p' let s:fmod = ':p'
else else
let s:fmod = ':.' let s:fmod = ':.'
@ -33,12 +34,12 @@ function! airline#extensions#fugitiveline#bufname()
if empty(b:fugitive_name) if empty(b:fugitive_name)
return fnamemodify(bufname('%'), s:fmod) return fnamemodify(bufname('%'), s:fmod)
else else
return fnamemodify(b:fugitive_name, s:fmod) return fnamemodify(b:fugitive_name, s:fmod). " [git]"
endif endif
endfunction endfunction
function! airline#extensions#fugitiveline#init(ext) function! airline#extensions#fugitiveline#init(ext)
if exists("+autochdir") && &autochdir == 1 if s:has_autochdir
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well " if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m') call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
else else

View File

@ -599,6 +599,9 @@ It is deactivated by default if |airline-bufferline| is activated.
* enable/disable bufferline integration > * enable/disable bufferline integration >
let g:airline#extensions#fugitiveline#enabled = 1 let g:airline#extensions#fugitiveline#enabled = 1
< <
If enabled, the buffer that comes from fugitive, will have added a trailing
"[git]" to be able do distinguish between fugitive and non-fugitive buffers.
------------------------------------- *airline-grepper* ------------------------------------- *airline-grepper*
vim-grepper <https://github.com/mhinz/vim-grepper> vim-grepper <https://github.com/mhinz/vim-grepper>