Change git_diff() to cache results for 10 seconds
This commit is contained in:
parent
6d1d2a3709
commit
6d8b1a41d2
1 changed files with 10 additions and 1 deletions
11
vimrc
11
vimrc
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue