Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions plugin/gv.vim
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ endfunction
function! s:maps()
nnoremap <silent> <buffer> q :$wincmd w <bar> close<cr>
nnoremap <silent> <buffer> <nowait> gq :$wincmd w <bar> close<cr>
nnoremap <silent> <buffer> r :call <sid>refresh()<cr>
nnoremap <silent> <buffer> gb :call <sid>gbrowse()<cr>
nnoremap <silent> <buffer> <cr> :call <sid>open(0)<cr>
nnoremap <silent> <buffer> o :call <sid>open(0)<cr>
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down