Change git_diff() to cache results for 10 seconds

This commit is contained in:
Talia 2018-04-12 09:38:32 +02:00
parent 6d1d2a3709
commit 6d8b1a41d2

11
vimrc
View file

@ -300,13 +300,22 @@ command! -nargs=* Hex call <sid>hex(<q-args>)
" === GIT STUFF === "
function! s:git_history()
if exists("b:git_history")
if b:git_history[0]+10 < localtime()
return b:git_history[1]
end
end
if exists("b:git_original_file") " Is this already a file@revision buffer?
let l:fname = b:git_original_file
else
let l:fname = expand("%")
end
let l:commits = system('git log --format="%h" --follow '.l:fname)
return split(l:commits, "\n")
let l:hist = split(l:commits, "\n")
let b:git_history = [localtime(), l:hist]
return l:hist
endfun
function! s:git_first()