From 54584a2bb223428601b3db5599cf8215dd90d434 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 2 Feb 2019 18:04:53 +0100 Subject: [PATCH] fugitive: mark fugitive like buffers with "[git]" closes #1852 --- autoload/airline/extensions/fugitiveline.vim | 7 ++++--- doc/airline.txt | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/fugitiveline.vim b/autoload/airline/extensions/fugitiveline.vim index 5dab9951..3afdad69 100644 --- a/autoload/airline/extensions/fugitiveline.vim +++ b/autoload/airline/extensions/fugitiveline.vim @@ -8,7 +8,8 @@ if !airline#util#has_fugitive() endif -if exists("+autochdir") && &autochdir == 1 +let s:has_autochdir = exists("+autochdir") && &autochdir +if s:has_autochdir let s:fmod = ':p' else let s:fmod = ':.' @@ -33,12 +34,12 @@ function! airline#extensions#fugitiveline#bufname() if empty(b:fugitive_name) return fnamemodify(bufname('%'), s:fmod) else - return fnamemodify(b:fugitive_name, s:fmod) + return fnamemodify(b:fugitive_name, s:fmod). " [git]" endif endfunction 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 call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m') else diff --git a/doc/airline.txt b/doc/airline.txt index 2de016f3..336e1516 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -599,6 +599,9 @@ It is deactivated by default if |airline-bufferline| is activated. * enable/disable bufferline integration > 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* vim-grepper