Skip to content

Commit

Permalink
D in :Gstatus not on a file invokes :Git diff
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Mar 20, 2010
1 parent 4975e76 commit 57393e7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugin/fugitive.vim
Expand Up @@ -539,13 +539,14 @@ function! fugitive#reload_status() abort
endfunction

function! s:StageDiff() abort
let section = getline(search('^# .*:$','bnW'))
let line = getline('.')
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
if filename ==# ''
return ''
endif
let section = getline(search('^# .*:$','bnW'))
if line =~# '^#\trenamed:' && filename =~ ' -> '
if filename ==# '' && section == '# Changes to be committed:'
return 'Git diff --cached'
elseif filename ==# ''
return 'Git diff'
elseif line =~# '^#\trenamed:' && filename =~ ' -> '
let [old, new] = split(filename,' -> ')
execute 'Gedit '.s:fnameescape(':0:'.new)
return 'Gdiff HEAD:'.s:fnameescape(old)
Expand Down

0 comments on commit 57393e7

Please sign in to comment.