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 endif
function! airline#extensions#fugitiveline#bufname() function! airline#extensions#fugitiveline#bufname()
if exists('b:fugitive_name') if !exists('b:fugitive_name')
return b:fugitive_name let b:fugitive_name = ''
endif
let b:fugitive_name = fnamemodify(bufname('%'), s:fmod)
try try
let buffer = fugitive#buffer() let buffer = fugitive#buffer()
if buffer.type('blob') if buffer.type('blob')
let b:fugitive_name = fnamemodify(buffer.repo().translate(buffer.path()), s:fmod) let b:fugitive_name = buffer.repo().translate(buffer.path())
endif endif
catch catch
endtry endtry
endif
return b:fugitive_name if empty(b:fugitive_name)
return fnamemodify(bufname('%'), s:fmod)
else
return fnamemodify(b:fugitive_name, s:fmod)
endif
endfunction endfunction
function! airline#extensions#fugitiveline#init(ext) function! airline#extensions#fugitiveline#init(ext)