diff --git a/plugin/gv.vim b/plugin/gv.vim index b59a12d..34f8aac 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -167,6 +167,7 @@ endfunction function! s:maps() nnoremap q :$wincmd w close nnoremap gq :$wincmd w close + nnoremap r :call refresh() nnoremap gb :call gbrowse() nnoremap :call open(0) nnoremap o :call open(0) @@ -246,15 +247,15 @@ function! s:log_opts(fugitive_repo, bang, visual, line1, line2) endfunction function! s:list(fugitive_repo, log_opts) - let default_opts = ['--color=never', '--date=short', '--format=%cd %h%d %s (%an)'] - let git_args = ['log'] + default_opts + a:log_opts - let git_log_cmd = FugitiveShellCommand(git_args, a:fugitive_repo) - let repo_short_name = fnamemodify(substitute(a:fugitive_repo.dir(), '[\\/]\.git[\\/]\?$', '', ''), ':t') let bufname = repo_short_name.' '.join(a:log_opts) silent exe (bufexists(bufname) ? 'buffer' : 'file') fnameescape(bufname) - call s:fill(git_log_cmd) + let default_opts = ['--color=never', '--date=short', '--format=%cd %h%d %s (%an)'] + let git_args = ['log'] + default_opts + a:log_opts + let b:git_log_cmd = FugitiveShellCommand(git_args, a:fugitive_repo) + + call s:fill(b:git_log_cmd) setlocal nowrap tabstop=8 cursorline iskeyword+=# if !exists(':GBrowse') @@ -263,7 +264,15 @@ function! s:list(fugitive_repo, log_opts) call s:maps() call s:syntax() redraw - echo 'o: open split / O: open tab / gb: GBrowse / q: quit' + echo 'o: open split / O: open tab / gb: GBrowse / r: refresh / q: quit' +endfunction + +function! s:refresh() + " refresh current GV buffer + setlocal modifiable + normal! gg"_dG + setlocal nomodifiable + call s:fill(b:git_log_cmd) endfunction function! s:trim(arg)