Cache only git calls, not bufname and fnamemodify

This commit is contained in:
Cimbali 2018-01-09 20:07:54 +01:00
parent 18da5aa699
commit a104e40b10

View File

@ -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)