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