Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ selected lines.
- `gb` for `:GBrowse`
- `]]` and `[[` to move between commits
- `.` to start command-line with `:Git [CURSOR] SHA` à la fugitive
- `r` to refresh git state
- `q` or `gq` to close

Customization
Expand Down
22 changes: 22 additions & 0 deletions plugin/gv.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ function! s:dot()
endfunction

function! s:maps()
nnoremap <buffer> <Plug>(gv-refresh) :<c-u>call <sid>refresh()<cr>

nnoremap <silent> <buffer> q :$wincmd w <bar> close<cr>
nnoremap <silent> <buffer> <nowait> gq :$wincmd w <bar> close<cr>
nnoremap <silent> <buffer> gb :call <sid>gbrowse()<cr>
Expand Down Expand Up @@ -317,6 +319,13 @@ function! s:gv(bang, visual, line1, line2, args) abort
call s:list(log_opts)
call FugitiveDetect(@#)
endif
let b:gv_opts = {
\ 'bang' : a:bang,
\ 'visual' : a:visual,
\ 'line1' : a:line1,
\ 'line2' : a:line2,
\ 'args' : a:args,
\ }
catch
return s:warn(v:exception)
finally
Expand All @@ -326,4 +335,17 @@ function! s:gv(bang, visual, line1, line2, args) abort
endtry
endfunction

function! s:refresh() abort
let lazyredraw_bak = &lazyredraw
let &lazyredraw = 1

let win = winsaveview()
let old_tab = tabpagenr()
call s:gv(b:gv_opts.bang, b:gv_opts.visual, b:gv_opts.line1, b:gv_opts.line2, b:gv_opts.args)
exec 'tabclose '. old_tab
call winrestview(win)

let &lazyredraw = lazyredraw_bak
endfunction

command! -bang -nargs=* -range=0 -complete=customlist,fugitive#CompleteObject GV call s:gv(<bang>0, <count>, <line1>, <line2>, <q-args>)