Show diff from :Gstatus interally

When pressing enter on a header in :Gstatus, use :Git! rather than :Git
to show the diff.

Closes #208.
This commit is contained in:
Tim Pope 2012-07-08 01:04:01 -04:00
parent 57af9b98cf
commit 8fd12ef14f

View File

@ -696,9 +696,9 @@ function! s:StageDiff(diff) abort
let line = getline('.') let line = getline('.')
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$') let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$')
if filename ==# '' && section ==# '# Changes to be committed:' if filename ==# '' && section ==# '# Changes to be committed:'
return 'Git diff --cached' return 'Git! diff --cached'
elseif filename ==# '' elseif filename ==# ''
return 'Git diff' return 'Git! diff'
elseif line =~# '^#\trenamed:' && filename =~# ' -> ' elseif line =~# '^#\trenamed:' && filename =~# ' -> '
let [old, new] = split(filename,' -> ') let [old, new] = split(filename,' -> ')
execute 'Gedit '.s:fnameescape(':0:'.new) execute 'Gedit '.s:fnameescape(':0:'.new)