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 === "
|
" === GIT STUFF === "
|
||||||
|
|
||||||
function! s:git_history()
|
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?
|
if exists("b:git_original_file") " Is this already a file@revision buffer?
|
||||||
let l:fname = b:git_original_file
|
let l:fname = b:git_original_file
|
||||||
else
|
else
|
||||||
let l:fname = expand("%")
|
let l:fname = expand("%")
|
||||||
end
|
end
|
||||||
let l:commits = system('git log --format="%h" --follow '.l:fname)
|
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
|
endfun
|
||||||
|
|
||||||
function! s:git_first()
|
function! s:git_first()
|
||||||
|
|
Loading…
Reference in a new issue