From 30df99a681da230bd59ec740813a474e8cdbc6d7 Mon Sep 17 00:00:00 2001 From: Quinn Strahl Date: Fri, 15 Aug 2014 16:07:18 -0400 Subject: [PATCH] Don't wipe out b:airline_head if fugitive finds the head - Fugitive can edit virtual files that represent objects in git; while editing these files, it still reports on the HEAD of the relevant repo, which should be displayed as the branch (rather than having the branch section disappear) --- autoload/airline/extensions/branch.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 250184d1..e97cae85 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -42,9 +42,11 @@ function! airline#extensions#branch#head() endif let b:airline_head = '' + let found_fugitive_head = 0 if s:has_fugitive && !exists('b:mercurial_dir') let b:airline_head = fugitive#head(7) + let found_fugitive_head = 1 if empty(b:airline_head) && !exists('b:git_dir') let b:airline_head = s:get_git_branch(expand("%:p:h")) @@ -66,7 +68,7 @@ function! airline#extensions#branch#head() endif endif - if empty(b:airline_head) || !s:check_in_path() + if empty(b:airline_head) || !found_fugitive_head && !s:check_in_path() let b:airline_head = '' endif