diff --git a/autoload/airline/extensions/fugitiveline.vim b/autoload/airline/extensions/fugitiveline.vim index dd69017..289121d 100644 --- a/autoload/airline/extensions/fugitiveline.vim +++ b/autoload/airline/extensions/fugitiveline.vim @@ -15,21 +15,22 @@ else endif function! airline#extensions#fugitiveline#bufname() - if exists('b:fugitive_name') - return b:fugitive_name + if !exists('b:fugitive_name') + let b:fugitive_name = '' + try + let buffer = fugitive#buffer() + if buffer.type('blob') + let b:fugitive_name = buffer.repo().translate(buffer.path()) + endif + catch + endtry endif - let b:fugitive_name = fnamemodify(bufname('%'), s:fmod) - - try - let buffer = fugitive#buffer() - if buffer.type('blob') - let b:fugitive_name = fnamemodify(buffer.repo().translate(buffer.path()), s:fmod) - endif - catch - endtry - - return b:fugitive_name + if empty(b:fugitive_name) + return fnamemodify(bufname('%'), s:fmod) + else + return fnamemodify(b:fugitive_name, s:fmod) + endif endfunction function! airline#extensions#fugitiveline#init(ext)