Use VCSCommand to display revision if available

This commit is contained in:
David Zderic 2013-11-08 10:36:59 +11:00
parent 3c9f8bb979
commit 2e8f99d39b

View File

@ -4,8 +4,9 @@
let s:has_fugitive = exists('*fugitive#head')
let s:has_fugitive_detect = exists('*fugitive#detect')
let s:has_lawrencium = exists('*lawrencium#statusline')
let s:has_vcscommand = exists('*VCSCommandGetStatusLine')
if !s:has_fugitive && !s:has_lawrencium
if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
finish
endif
@ -31,6 +32,15 @@ function! airline#extensions#branch#get_head()
endif
endif
if empty(head)
if s:has_vcscommand
call VCSCommandEnableBufferSetup()
if exists('b:VCSCommandBufferInfo')
let head = get(b:VCSCommandBufferInfo, 0, '')
endif
endif
endif
return empty(head) || !s:check_in_path()
\ ? s:empty_message
\ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head)